Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1473519imm; Sun, 15 Jul 2018 08:36:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0ljLfUiN8C3hyM6wsykbLBEFTYH9SP/VvunowWEvO5t1Nj+gGrVYuzHq2FnV1oyHVqUuQ X-Received: by 2002:a63:af14:: with SMTP id w20-v6mr13136529pge.47.1531669002962; Sun, 15 Jul 2018 08:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531669002; cv=none; d=google.com; s=arc-20160816; b=UgrfXyln6pUCKblDWa+59vlc11uXNqtroPXxtPEtM7eXBzdjp3sdzUESYH6nnD1gWo sQMl66E2+IF7dK80booTsDq/M7KzlJGyO3pSMxEdp0Ovjy1TaHQAcu+5ua21PyTfR4Ey /GR0c4SaOBkdVz+3KkQBASk8R5ces+7AX926quW1CE5YhKvoqRkalMwTFpL6eFVjMe9U nNr2KRC337ch0q/MCOfrUehrwELYClfy2UP3l+ThJRmt2Ba/eYOmCK6clIP+4nZdQuNY vwxAV5d8ZXRH6S9/wHXGgC7TaS1jxLEpSOPDzbs4K/hh5mwoGaJEMxojyg0o7iko+mCJ GWqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=ggljRTRq/t94V/WKcL/itgrdSyj1Z4L7YrX189WNs90=; b=zEg33FvXU+8+U739lbGxAGjWsVkoTKAVWXtefyWZ6DYPc/2gr+el2F1s7rNUqHcABG NpdC78kVhRwg+lMqirTvNe+INs9b2j5xuoP5FvfUuLG8GXW2x0rMtI5H5N4xqJus4O5M BZhSJ2HGjaECfh3AWVBZg2UkrqZAsJtfhuBA1UFuwYv6cGwuNAZ4UxTcI8zGdgfAE8RB PNqC3w/UOBaOzhFG9W/uDuNDz3hzbDfoNWjTOT4tSyeCdDLyQJJGQa7Qi+cXwUW+gZki Pj5ylnVs77CnReSQrBFGvY+Va+Ac60/mVWjLABooYcVJJi9bTKpyD7n0mO0GqAKIej+Q nGwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qwv6PCnr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25-v6si26524637pfp.108.2018.07.15.08.36.26; Sun, 15 Jul 2018 08:36:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qwv6PCnr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbeGOP7M (ORCPT + 99 others); Sun, 15 Jul 2018 11:59:12 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:44173 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbeGOP7M (ORCPT ); Sun, 15 Jul 2018 11:59:12 -0400 Received: by mail-oi0-f49.google.com with SMTP id s198-v6so70422716oih.11 for ; Sun, 15 Jul 2018 08:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ggljRTRq/t94V/WKcL/itgrdSyj1Z4L7YrX189WNs90=; b=Qwv6PCnrHwsh+qeRgw+ooyga9A6sbq2tY6vGw/LUtBnmbfoSeFcQaJ/Kgwj8bJakwY uto0cIQrYqAAG1iga64gMoqNNpoG44eGwTFbkjelyIOvYtJ+9Cardr2/J0e+4/pZWSrw YpnmpOpwVXQKXJBfQfblzaD/ZwXRpEGwneoo27I405rdW14lt54CFUGmZRQLYD3QfaFW 7BrfRGWtzF2fSJUX3qLGXoDzKqdrczB9IKo0/7JArqNvt2ysRmYQ+6XGoLaeZEm+9IbC ymkniSzfSXUI0DkyJ/+/aUKMlC3oDm8bodi2BdW8w10uFsm95roXmzm/oQ1fEtSjlBUV sphA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ggljRTRq/t94V/WKcL/itgrdSyj1Z4L7YrX189WNs90=; b=RfkZBRQFbSEXjerwE3af/fz4FxT8TWwqIQ4L3SO5IEAiDusQPNp5pyjxYANbju5n5Y 0fGkvACdakO8fdlei82n2uWC79BH1n12OqIChYOyakxLuJavvgDjd1xnDkScquWuuMz2 ba930x37+odAp8zBPXZE+ojmorkZxhKDw8o/QYlXFEZH9Tmc/k6pPUkbiicnn+mF+Z1l ONdQBRaBrOiHj4P4H7TIwXDLwxjVd4zSPICOv8WsfSmCRp8xZnhv1DZ7cnSZqda9zz0n qbhRmg2Tmgx9kgRDaNESZ8ZZrXoazWp/sKkti7jpI/ww59Xik5Y48h78vTei2tQhkuoz Q+ag== X-Gm-Message-State: AOUpUlEjCA6Ip9qbTRSLlRm3ZGMWxz1uM2h93WY0iK9H7q1q5fxjeuF2 kB/tDrKvPFaYKeMgm5RKxnJv4c/d3wH7Yrl/Lw8= X-Received: by 2002:aca:d5d3:: with SMTP id m202-v6mr14060054oig.93.1531668952214; Sun, 15 Jul 2018 08:35:52 -0700 (PDT) MIME-Version: 1.0 References: <878t6c7f8p.fsf@mail.parknet.co.jp> <20180715143043.GM30522@ZenIV.linux.org.uk> <87h8l0y0z8.fsf@mail.parknet.co.jp> In-Reply-To: <87h8l0y0z8.fsf@mail.parknet.co.jp> From: Anatoly Trosinenko Date: Sun, 15 Jul 2018 18:35:40 +0300 Message-ID: Subject: Re: FAT: Operating on broken FAT FS causes the write syscall to return negative number not equal to -1 To: OGAWA Hirofumi Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for explanation! Best regards, Anatoly =D0=B2=D1=81, 15 =D0=B8=D1=8E=D0=BB. 2018 =D0=B3. =D0=B2 18:26, OGAWA Hirof= umi : > > Anatoly Trosinenko writes: > > >> This patch returns better error (-EIO) for me. > > > > This works for me likewise. > > Thanks for testing. > > >> (But note, the corrupted FS image doesn't guarantee POSIX behavior.) > > > > Oops, I was just doing some testing and thought that correct behavior > > for crafted FS is to return arbitrary valid error code (like -EIO) or > > some arbitrary data, say, not larger than FS (not disclosing the > > kernel memory, of course). Please excuse me if I was wrong. If fixing > > this would slow down some hot code path, then I am not insisting on > > returning valid errno. :) > > > > Meanwhile, how should be considered such discrepancies with man pages > > for invalid FS images: should it be considered low priority bug, > > not-a-bug or feature request (diagnostics)? > > To handle the corrupted image _perfectly_, finally we will have to have > online fsck or similar. > > For example, if the data block was shared between the regular file and > directory, user can mmap the directory data via (corrupted) regular > file. > > Then locking of directory handler doesn't work, and handler has to have > directory data as volatile data (and validate data for each memory > load). And to verify this invalid shared data blocks, we will have to > read all inodes (i.e. almost fsck). > > So, I may change the code if data verification is easy and lightweight > like in this case. But like said above, it will not be guaranteed. > > Thanks. > -- > OGAWA Hirofumi