public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>, linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: fix fallocate to use file_modified to update permissions consistently
Date: Wed, 9 Mar 2022 20:31:09 -0800	[thread overview]
Message-ID: <Yil/Dac4kraFdMuy@sol.localdomain> (raw)
In-Reply-To: <20220308185043.GA117678@magnolia>

On Tue, Mar 08, 2022 at 10:50:43AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Since the initial introduction of (posix) fallocate back at the turn of
> the century, it has been possible to use this syscall to change the
> user-visible contents of files.  This can happen by extending the file
> size during a preallocation, or through any of the newer modes (punch,
> zero, collapse, insert range).  Because the call can be used to change
> file contents, we should treat it like we do any other modification to a
> file -- update the mtime, and drop set[ug]id privileges/capabilities.
> 
> The VFS function file_modified() does all this for us if pass it a
> locked inode, so let's make fallocate drop permissions correctly.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/ext4/ext4.h    |    2 +-
>  fs/ext4/extents.c |   32 +++++++++++++++++++++++++-------
>  fs/ext4/inode.c   |    7 ++++++-
>  3 files changed, 32 insertions(+), 9 deletions(-)

Is there a test in xfstests that tests for this?

- Eric

  reply	other threads:[~2022-03-10  4:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 18:50 [PATCH] ext4: fix fallocate to use file_modified to update permissions consistently Darrick J. Wong
2022-03-10  4:31 ` Eric Biggers [this message]
2022-03-10 17:43   ` Darrick J. Wong
2022-03-10 17:44 ` [PATCH RFC] fstests: ensure we drop suid after fallocate Darrick J. Wong
2022-03-24 14:55 ` [PATCH] ext4: fix fallocate to use file_modified to update permissions consistently Theodore Ts'o

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=Yil/Dac4kraFdMuy@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-ext4@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox