Linux Security Modules development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Brauner" <brauner@kernel.org>
Cc: "Jann Horn" <jannh@google.com>, "Chris Mason" <mason@kernel.org>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"Christoph Hellwig" <hch@lst.de>,
	linux-nvme@lists.infradead.org,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Jan Kara" <jack@suse.cz>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-mm@kvack.org, bpf@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
	apparmor@lists.ubuntu.com, linux-efi@vger.kernel.org,
	linux-s390@vger.kernel.org, linux-usb@vger.kernel.org,
	"Amir Goldstein" <amir73il@gmail.com>,
	"Chuck Lever" <cel@kernel.org>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Anna Schumaker" <anna@kernel.org>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joel Becker" <jlbec@evilplan.org>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>
Subject: Re: [PATCH RFC v3 34/44] selftests/ovl: test data-only layers on pseudo filesystems
Date: Mon, 16 Nov 2026 11:28:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-216927@kernel.org> (raw)
In-Reply-To: <20261116-work-loop-pseudo-v3-34-8cbbea1cf34f@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/ovl: missing prerequisite skips in setup_tmp() and
  tests
- [Low] selftests/ovl: duplicated setup_tmp() and datadir test cases
--

commit 9dfbd53c60eeeb8dceed3a46417fda9ee76bb58b
Author: Christian Brauner <brauner@kernel.org>

selftests/ovl: test data-only layers on pseudo filesystems

This commit adds an overlayfs selftest verifying that data-only layers on
pseudo filesystems (sysfs and procfs) are rejected while tmpfs data-only
layers and sysfs lower layers remain allowed.

> diff --git a/tools/testing/selftests/filesystems/overlayfs/pseudo_datadir.c b/tools/testing/selftests/filesystems/overlayfs/pseudo_datadir.c
> new file mode 100644
> index 0000000000000..3b59fd3e9f5c2
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/overlayfs/pseudo_datadir.c
> @@ -0,0 +1,131 @@
[ ... ]
> +static int setup_tmp(void)
> +{
> +	if (unshare(CLONE_NEWNS))
> +		return -errno;
> +	if (sys_mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL))
> +		return -errno;
> +	if (sys_mount("tmpfs", "/tmp", "tmpfs", 0, NULL))
> +		return -errno;
> +	if (mkdir("/tmp/lower", 0755) || mkdir("/tmp/data", 0755) ||
> +	    mkdir("/tmp/merged", 0755))
> +		return -errno;
> +	return 0;
> +}

[Severity: Low]
Should these tests invoke SKIP() with a reason string when root privileges
or kernel overlayfs support are unavailable?

Running this test without root privileges causes setup_tmp() to fail with
-EPERM on unshare(CLONE_NEWNS), and running on a kernel without
CONFIG_OVERLAY_FS causes mount_lowerdir() and fsmount_layers() to return
-ENODEV, failing all four tests in make run_tests instead of skipping them.

[ ... ]

> +TEST(datadir_sysfs)
> +{
> +	ASSERT_EQ(setup_tmp(), 0);
> +
> +	EXPECT_EQ(mount_lowerdir("/tmp/lower::/sys/kernel"), -EINVAL);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/sys/kernel", false), -EINVAL);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/sys/kernel", true), -EINVAL);
> +}
> +
> +TEST(datadir_procfs)
> +{
> +	ASSERT_EQ(setup_tmp(), 0);
> +
> +	EXPECT_EQ(mount_lowerdir("/tmp/lower::/proc"), -EINVAL);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/proc", false), -EINVAL);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/proc", true), -EINVAL);
> +}
> +
> +TEST(datadir_tmpfs)
> +{
> +	ASSERT_EQ(setup_tmp(), 0);
> +
> +	EXPECT_EQ(mount_lowerdir("/tmp/lower::/tmp/data"), 0);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/tmp/data", false), 0);
> +	EXPECT_EQ(fsmount_layers("/tmp/lower", "/tmp/data", true), 0);
> +}
> +
> +TEST(lowerdir_sysfs)
> +{
> +	ASSERT_EQ(setup_tmp(), 0);

[Severity: Low]
This isn't a bug, but could setup_tmp() move into a FIXTURE_SETUP() block,
and could the three datadir_* tests be parameterized with FIXTURE_VARIANT()
over the path and expected return code to avoid duplicating the setup and
mount sequence?  Also, since set_layers_via_fds.c already tests lowerdir+
and datadir+ layer configuration, should these cases live there instead of
in a new standalone binary?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-work-loop-pseudo-v3-0-8cbbea1cf34f@kernel.org?part=34

  reply	other threads:[~2026-11-16 11:28 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 11:04 [PATCH RFC v3 00/44] fs: don't use pseudo filesystem files as storage Christian Brauner
2026-11-16 11:04 ` [PATCH RFC v3 01/44] loop: refuse backing files that aren't open for reading Christian Brauner
2026-11-16 11:24   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 02/44] nvmet: check that the file backend supports ->{read,write}_iter Christian Brauner
2026-11-16 11:15   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 03/44] target: fileio: check that the backing file " Christian Brauner
2026-11-16 11:25   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 04/44] fs: add SB_I_PSEUDO Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 05/44] kernfs: use fc_init_pseudo() Christian Brauner
2026-11-16 11:19   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 06/44] proc: " Christian Brauner
2026-11-16 11:17   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 07/44] binfmt_misc: " Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 08/44] mqueue: " Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 09/44] bpf: use fc_init_pseudo() for bpffs Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 10/44] nullfs: use fc_init_pseudo() Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 11/44] failfs: " Christian Brauner
2026-11-16 11:17   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 12/44] rust_binderfs: " Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 13/44] devpts: " Christian Brauner
2026-11-16 11:16   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 14/44] debugfs: " Christian Brauner
2026-11-16 11:15   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 15/44] tracefs: " Christian Brauner
2026-11-16 11:17   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 16/44] configfs: " Christian Brauner
2026-11-16 11:18   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 17/44] securityfs: " Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 18/44] selinux: use fc_init_pseudo() for selinuxfs Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 19/44] smack: use fc_init_pseudo() for smackfs Christian Brauner
2026-11-16 11:18   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 20/44] apparmor: use fc_init_pseudo() for apparmorfs Christian Brauner
2026-11-16 11:19   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 21/44] nfsd: use fc_init_pseudo() Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 22/44] sunrpc: use fc_init_pseudo() for rpc_pipefs Christian Brauner
2026-11-16 11:19   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 23/44] fuse: use fc_init_pseudo() for fusectl Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 24/44] efivarfs: use fc_init_pseudo() Christian Brauner
2026-11-16 11:21   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 25/44] pstore: " Christian Brauner
2026-11-16 11:19   ` sashiko-bot
2026-11-16 11:04 ` [PATCH RFC v3 26/44] xenfs: " Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 27/44] openpromfs: " Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 28/44] ocfs2: use fc_init_pseudo() for dlmfs Christian Brauner
2026-11-16 11:20   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 29/44] s390/hypfs: use fc_init_pseudo() Christian Brauner
2026-11-16 11:23   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 30/44] powerpc/spufs: " Christian Brauner
2026-11-16 11:28   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 31/44] usb: gadget: f_fs: " Christian Brauner
2026-11-16 11:21   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 32/44] usb: gadget: gadgetfs: " Christian Brauner
2026-11-16 11:21   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 33/44] ovl: refuse data-only layers on pseudo filesystems Christian Brauner
2026-11-16 11:27   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 34/44] selftests/ovl: test " Christian Brauner
2026-11-16 11:28   ` sashiko-bot [this message]
2026-11-16 11:05 ` [PATCH RFC v3 35/44] fs: add file_check_backing() Christian Brauner
2026-11-16 11:30   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 36/44] loop: refuse files on pseudo filesystems as backing files Christian Brauner
2026-11-16 11:28   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 37/44] zloop: refuse zone files on pseudo filesystems Christian Brauner
2026-11-16 11:28   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 38/44] nvmet: refuse files on pseudo filesystems as namespace backing files Christian Brauner
2026-11-16 11:24   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 39/44] target: fileio: refuse files on pseudo filesystems as " Christian Brauner
2026-11-16 11:23   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 40/44] fuse: refuse files on pseudo filesystems as passthrough " Christian Brauner
2026-11-16 11:26   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 41/44] usb: gadget: f_mass_storage: refuse files on pseudo filesystems Christian Brauner
2026-11-16 11:26   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 42/44] erofs: refuse files on pseudo filesystems as backing files Christian Brauner
2026-11-16 11:25   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 43/44] acct: refuse files on pseudo filesystems Christian Brauner
2026-11-16 11:27   ` sashiko-bot
2026-11-16 11:05 ` [PATCH RFC v3 44/44] selftests/filesystems: add backing file tests for pseudo files Christian Brauner
2026-11-16 11:29   ` sashiko-bot

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=sashiko-outbox-216927@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=amir73il@gmail.com \
    --cc=anna@kernel.org \
    --cc=apparmor@lists.ubuntu.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=jlayton@kernel.org \
    --cc=jlbec@evilplan.org \
    --cc=josef@toxicpanda.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=mason@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=selinux@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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