All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>,
	Eryu Guan <guaneryu@gmail.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>, Eryu Guan <guan@eryu.me>
Subject: Re: [PATCH 2/4] generic: ensure we drop suid after fallocate
Date: Wed, 13 Apr 2022 10:58:41 +0300	[thread overview]
Message-ID: <CAOQ4uxiDW6=qgWtH8uHkOmAyZBR7vfgwgt-DA_Rn0QVihQZQLw@mail.gmail.com> (raw)
In-Reply-To: <20220412115205.d6jjudlkxs72vezd@zlang-mailbox>

On Wed, Apr 13, 2022 at 1:18 AM Zorro Lang <zlang@redhat.com> wrote:
>
> On Mon, Apr 11, 2022 at 03:54:42PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > fallocate changes file contents, so make sure that we drop privileges
> > and file capabilities after each fallocate operation.
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/generic/834     |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/834.out |   33 +++++++++++++
> >  tests/generic/835     |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/835.out |   33 +++++++++++++
> >  tests/generic/836     |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/836.out |   33 +++++++++++++
> >  tests/generic/837     |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/837.out |   33 +++++++++++++
> >  tests/generic/838     |  127 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/838.out |   33 +++++++++++++
> >  tests/generic/839     |   77 ++++++++++++++++++++++++++++++
> >  tests/generic/839.out |   13 +++++
> >  12 files changed, 890 insertions(+)
> >  create mode 100755 tests/generic/834
> >  create mode 100644 tests/generic/834.out
> >  create mode 100755 tests/generic/835
> >  create mode 100644 tests/generic/835.out
> >  create mode 100755 tests/generic/836
> >  create mode 100644 tests/generic/836.out
> >  create mode 100755 tests/generic/837
> >  create mode 100644 tests/generic/837.out
> >  create mode 100755 tests/generic/838
> >  create mode 100644 tests/generic/838.out
> >  create mode 100755 tests/generic/839
> >  create mode 100755 tests/generic/839.out
> >
> >
> > diff --git a/tests/generic/834 b/tests/generic/834
> > new file mode 100755
> > index 00000000..9302137b
> > --- /dev/null
> > +++ b/tests/generic/834
> > @@ -0,0 +1,127 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test No. 834
> > +#
> > +# Functional test for dropping suid and sgid bits as part of a fallocate.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto clone quick
> > +
> > +# Override the default cleanup function.
> > +_cleanup()
> > +{
> > +     cd /
> > +     rm -r -f $tmp.* $junk_dir
> > +}
> > +
> > +# Import common functions.
> > +. ./common/filter
> > +. ./common/reflink
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs xfs btrfs ext4
>
> So we have more cases will break downstream XFS testing :)

Funny you should mention that.
I was going to propose an RFC for something like:

_fixed_by_kernel_commit fbe7e5200365 "xfs: fallocate() should call
file_modified()"

The first thing that could be done with this standard annotation is print a
hint on failure, like LTP does:

HINT: You _MAY_ be missing kernel fixes:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fbe7e5200365

The second thing to be done is that downstream testers could use a script
to auto-generate an expunge list for their test kernel, if they don't care about
testing known issues, only regressions.

I hope that with the new maintainship you will also take the opportunity
to make fstests more friendly to downstream kernel testers.

> All cases looks good, but according to the custom, all generic cases use
> "_supported_fs generic", if you have 1+ specified filesystems, maybe
> "tests/shared/*" is better?
>

I think we should stay away from tests/shared for as much as possible and
use it only for very specific fs behaviors.

What in the behavior of fallocate() and setgid makes it so special that it needs
to be restricted to "xfs btrfs ext4" and not treated as a bug for other fs?
I suspect that it might be difficult or impossible to change that behavior in
network filesystems?

When facing a similar dilemma in the past we ended up with a whitelist
_fstyp_has_non_default_seek_data_hole(), but not sure we need to resort to that.

Thanks,
Amir.

  reply	other threads:[~2022-04-13  7:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 22:54 [PATCHSET 0/4] fstests: new tests for kernel 5.18 Darrick J. Wong
2022-04-11 22:54 ` [PATCH 1/4] xfs: make sure syncfs(2) passes back super_operations.sync_fs errors Darrick J. Wong
2022-04-12  9:37   ` Zorro Lang
2022-04-12 17:28     ` Darrick J. Wong
2022-04-14 14:43       ` Zorro Lang
2022-04-14 15:42         ` Darrick J. Wong
2022-04-14 18:58           ` Zorro Lang
2022-04-11 22:54 ` [PATCH 2/4] generic: ensure we drop suid after fallocate Darrick J. Wong
2022-04-12 11:52   ` Zorro Lang
2022-04-13  7:58     ` Amir Goldstein [this message]
2022-04-13 15:44       ` Zorro Lang
2022-04-14 15:50         ` Darrick J. Wong
2022-04-14 19:10           ` Zorro Lang
2022-04-15 13:42             ` Amir Goldstein
2022-04-16 14:01               ` Zorro Lang
2022-04-16 17:30                 ` Amir Goldstein
2022-04-17 15:40               ` Eryu Guan
2022-04-19 17:18                 ` Darrick J. Wong
2022-04-15  8:54           ` Amir Goldstein
2022-04-11 22:54 ` [PATCH 3/4] generic: test that linking into a directory fails with EDQUOT Darrick J. Wong
2022-04-12 17:17   ` Zorro Lang
2022-04-12 17:52     ` Darrick J. Wong
2022-04-14 19:12       ` Zorro Lang
2022-04-11 22:54 ` [PATCH 4/4] generic: test that renaming " Darrick J. Wong
2022-04-12 17:29   ` Zorro Lang
2022-04-12 17:58     ` Darrick J. Wong
2022-04-14 19:13       ` Zorro Lang

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='CAOQ4uxiDW6=qgWtH8uHkOmAyZBR7vfgwgt-DA_Rn0QVihQZQLw@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /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.