All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>, Chao Yu <chao@kernel.org>,
	Theodore Ts'o <tytso@mit.edu>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: remove broken support for allocating DIO writes
Date: Tue, 17 Aug 2021 17:06:22 -0700	[thread overview]
Message-ID: <YRxO/tzo15OTfbaZ@gmail.com> (raw)
In-Reply-To: <YRwrDdcryfTH4Vwi@google.com>

On Tue, Aug 17, 2021 at 02:33:01PM -0700, Jaegeuk Kim wrote:
> On 08/17, Eric Biggers wrote:
> > On Tue, Aug 17, 2021 at 11:57:46AM -0700, Jaegeuk Kim wrote:
> > > On 08/17, Christoph Hellwig wrote:
> > > > On Mon, Aug 16, 2021 at 07:03:21PM -0700, Eric Biggers wrote:
> > > > > Freeing preallocated blocks on error would be better than nothing, although note
> > > > > that the preallocated blocks may have filled an arbitrary sequence of holes --
> > > > > so simply truncating past EOF would *not* be sufficient.
> > > > > 
> > > > > But really filesystems need to be designed to never expose uninitialized data,
> > > > > even if I/O errors or a sudden power failure occurs.  It is unfortunate that
> > > > > f2fs apparently wasn't designed with that goal in mind.
> > > > > 
> > > > > In any case, I don't think we can proceed with any other f2fs direct I/O
> > > > > improvements until this data leakage bug can be solved one way or another.  If
> > > > > my patch to remove support for allocating writes isn't acceptable and the
> > > > > desired solution is going to require some more invasive f2fs surgery, are you or
> > > > > Chao going to work on it?  I'm not sure there's much I can do here.
> > > > 
> > > > Btw, this is generally a problem for buffered I/O as well, although the
> > > > window for exposing uninitialized blocks on a crash tends to be smaller.
> > > 
> > > How about adding a warning message when we meet an error with preallocated
> > > unwritten blocks? In the meantime, can we get the Eric's patches for iomap
> > > support? I feel that we only need to modify the preallocation and error
> > > handling parts?
> > 
> > A warning message would do nothing to prevent uninitialized blocks from being
> > leaked to userspace.
> 
> To give a signal that it's a known issue that we'll fix later.
> 

This bug is concerning mainly because it's a security vulnerability: anyone with
read+write access to just one file on an f2fs filesystem can effectively read
all other files on that filesystem.  A warning message wouldn't change that.

And even in the case of this bug breaking a non-malicious program, hardly anyone
reads kernel log messages anyway.  If something is broken, having a log message
that says "yeah, this is broken, sorry" isn't going to accomplish much...

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>,
	stable@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	Christoph Hellwig <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH] f2fs: remove broken support for allocating DIO writes
Date: Tue, 17 Aug 2021 17:06:22 -0700	[thread overview]
Message-ID: <YRxO/tzo15OTfbaZ@gmail.com> (raw)
In-Reply-To: <YRwrDdcryfTH4Vwi@google.com>

On Tue, Aug 17, 2021 at 02:33:01PM -0700, Jaegeuk Kim wrote:
> On 08/17, Eric Biggers wrote:
> > On Tue, Aug 17, 2021 at 11:57:46AM -0700, Jaegeuk Kim wrote:
> > > On 08/17, Christoph Hellwig wrote:
> > > > On Mon, Aug 16, 2021 at 07:03:21PM -0700, Eric Biggers wrote:
> > > > > Freeing preallocated blocks on error would be better than nothing, although note
> > > > > that the preallocated blocks may have filled an arbitrary sequence of holes --
> > > > > so simply truncating past EOF would *not* be sufficient.
> > > > > 
> > > > > But really filesystems need to be designed to never expose uninitialized data,
> > > > > even if I/O errors or a sudden power failure occurs.  It is unfortunate that
> > > > > f2fs apparently wasn't designed with that goal in mind.
> > > > > 
> > > > > In any case, I don't think we can proceed with any other f2fs direct I/O
> > > > > improvements until this data leakage bug can be solved one way or another.  If
> > > > > my patch to remove support for allocating writes isn't acceptable and the
> > > > > desired solution is going to require some more invasive f2fs surgery, are you or
> > > > > Chao going to work on it?  I'm not sure there's much I can do here.
> > > > 
> > > > Btw, this is generally a problem for buffered I/O as well, although the
> > > > window for exposing uninitialized blocks on a crash tends to be smaller.
> > > 
> > > How about adding a warning message when we meet an error with preallocated
> > > unwritten blocks? In the meantime, can we get the Eric's patches for iomap
> > > support? I feel that we only need to modify the preallocation and error
> > > handling parts?
> > 
> > A warning message would do nothing to prevent uninitialized blocks from being
> > leaked to userspace.
> 
> To give a signal that it's a known issue that we'll fix later.
> 

This bug is concerning mainly because it's a security vulnerability: anyone with
read+write access to just one file on an f2fs filesystem can effectively read
all other files on that filesystem.  A warning message wouldn't change that.

And even in the case of this bug breaking a non-malicious program, hardly anyone
reads kernel log messages anyway.  If something is broken, having a log message
that says "yeah, this is broken, sorry" isn't going to accomplish much...

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2021-08-18  0:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  1:51 [f2fs-dev] [PATCH] f2fs: remove broken support for allocating DIO writes Eric Biggers
2021-07-28  1:51 ` Eric Biggers
2021-07-30 19:17 ` [f2fs-dev] " Eric Biggers
2021-07-30 19:17   ` Eric Biggers
2021-07-30 22:12   ` [f2fs-dev] " Jaegeuk Kim
2021-07-30 22:12     ` Jaegeuk Kim
2021-07-30 22:19     ` Eric Biggers
2021-07-30 22:19       ` [f2fs-dev] " Eric Biggers
2021-07-31  1:05       ` Jaegeuk Kim
2021-07-31  1:05         ` [f2fs-dev] " Jaegeuk Kim
2021-07-31  1:18         ` Eric Biggers
2021-07-31  1:18           ` Eric Biggers
2021-07-31  2:46   ` Theodore Ts'o
2021-07-31  2:46     ` [f2fs-dev] " Theodore Ts'o
2021-08-02  4:39     ` Eric Biggers
2021-08-02  4:39       ` Eric Biggers
2021-08-02  9:00       ` Chao Yu
2021-08-02  9:00         ` [f2fs-dev] " Chao Yu
2021-08-02 18:23         ` Jaegeuk Kim
2021-08-02 18:23           ` Jaegeuk Kim
2021-08-03  1:19           ` [f2fs-dev] " Chao Yu
2021-08-03  1:19             ` Chao Yu
2021-08-03  1:34             ` [f2fs-dev] " Jaegeuk Kim
2021-08-03  1:34               ` Jaegeuk Kim
2021-08-17  2:03               ` [f2fs-dev] " Eric Biggers
2021-08-17  2:03                 ` Eric Biggers
2021-08-17  5:42                 ` [f2fs-dev] " Christoph Hellwig
2021-08-17  5:42                   ` Christoph Hellwig
2021-08-17 18:57                   ` Jaegeuk Kim
2021-08-17 18:57                     ` [f2fs-dev] " Jaegeuk Kim
2021-08-17 20:27                     ` Eric Biggers
2021-08-17 20:27                       ` [f2fs-dev] " Eric Biggers
2021-08-17 21:33                       ` Jaegeuk Kim
2021-08-17 21:33                         ` Jaegeuk Kim
2021-08-18  0:06                         ` Eric Biggers [this message]
2021-08-18  0:06                           ` Eric Biggers
2021-08-20  9:35                 ` Chao Yu
2021-08-20  9:35                   ` [f2fs-dev] " Chao Yu
2021-08-20 18:11                   ` Eric Biggers
2021-08-20 18:11                     ` Eric Biggers
2021-08-20 22:01                     ` [f2fs-dev] " Chao Yu
2021-08-20 22:01                       ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRxO/tzo15OTfbaZ@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=chao@kernel.org \
    --cc=hch@infradead.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.