mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: brauner@kernel.org,linux-fsdevel@vger.kernel.org
Cc: jannh@google.com,mason@kernel.org,josef@toxicpanda.com,hch@lst.de,linux-block@vger.kernel.org,linux-kernel@vger.kernel.org,linux-nvme@lists.infradead.org,viro@zeniv.linux.org.uk,jack@suse.cz,linux-scsi@vger.kernel.org,target-devel@vger.kernel.org,driver-core@lists.linux.dev,linux-mm@kvack.org,bpf@vger.kernel.org,linux-security-module@vger.kernel.org,selinux@vger.kernel.org,apparmor@lists.ubuntu.com,linux-nfs@vger.kernel.org,netdev@vger.kernel.org,fuse-devel@lists.linux.dev,linux-efi@vger.kernel.org,xen-devel@lists.xenproject.org,ocfs2-devel@lists.linux.dev,linux-s390@vger.kernel.org,linuxppc-dev@lists.ozlabs.org,linux-usb@vger.kernel.org,amir73il@gmail.com,linux-erofs@lists.ozlabs.org,linux-kselftest@vger.kernel.org,brauner@kernel.org,alex@amutable.com,chris@chrisdown.name,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH RFC v3 44/44] selftests/filesystems: add backing file tests for pseudo files
Date: Mon, 16 Nov 2026 12:00:17 +0000 (UTC)	[thread overview]
Message-ID: <56b5bed0bd75b5b0c7368009493734cda89f1ca37c0fc29c81ed65048cbfeca4@mail.kernel.org> (raw)
In-Reply-To: <20261116-work-loop-pseudo-v3-44-8cbbea1cf34f@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 5271 bytes --]

> selftests/filesystems: add backing file tests for pseudo files

TL;DR:
- Selftest: fuse tests may fail instead of skip without
  CONFIG_FUSE_PASSTHROUGH (-EOPNOTSUPP, not -EPERM)
- Metacopy test may fail without CONFIG_TMPFS_XATTR
- Minor duplicated setup code

> diff --git a/tools/testing/selftests/filesystems/config b/tools/testing/selftests/filesystems/config
> --- a/tools/testing/selftests/filesystems/config
> +++ b/tools/testing/selftests/filesystems/config
> @@ -6,3 +6,19 @@ CONFIG_NET=y
>  CONFIG_NET_NS=y
>  CONFIG_INET=y
>  CONFIG_SYSFS=y
> +CONFIG_BLK_DEV_LOOP=y
> +CONFIG_OVERLAY_FS=y
> +CONFIG_TMPFS=y
> +CONFIG_CONFIGFS_FS=y
[ ... ]

Should CONFIG_TMPFS_XATTR=y be added here as well?

TEST(fuse_passthrough_overlayfs_metacopy_file) mounts a private tmpfs
through setup_tmp() and then does:

    ASSERT_EQ(setxattr("/tmp/lower/file", "trusted.overlay.metacopy",
                       "", 0, 0), 0);

shmem_fill_super() only sets sb->s_xattr under CONFIG_TMPFS_XATTR, which
defaults to n, and CONFIG_TMPFS does not select it.  Without it
setxattr() fails with EOPNOTSUPP, the ASSERT_EQ() aborts, and the run
reports a failure rather than a skip.  tools/testing/selftests/landlock/config
lists CONFIG_TMPFS_XATTR=y next to CONFIG_TMPFS=y.

Alternatively the test could SKIP when setxattr() returns EOPNOTSUPP.

> diff --git a/tools/testing/selftests/filesystems/pseudo_backing_test.c b/tools/testing/selftests/filesystems/pseudo_backing_test.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/pseudo_backing_test.c

[ ... ]

> +TEST(overlayfs_on_sysfs_backing_file)
> +{
> +	if (!can_use_loop())
> +		SKIP(return, "loop devices unavailable");
> +
> +	ASSERT_EQ(unshare(CLONE_NEWNS), 0);
> +	ASSERT_EQ(mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL), 0);
> +	ASSERT_EQ(mount("tmpfs", "/tmp", "tmpfs", 0, NULL), 0);

this isn't a bug, but could overlayfs_on_sysfs_backing_file() call
ASSERT_EQ(setup_tmp(), 0) like the other tests, instead of repeating its
three steps?  Similarly, usb_mass_storage_backing_file() repeats the
statfs()/CONFIGFS_MAGIC/mount() logic of setup_configfs(), and the comment
"Mounting configfs on top of itself fails with EBUSY." appears twice.

[ ... ]

> +TEST(fuse_passthrough_backing_file)
> +{
> +	int fuse_fd, ret;
> +
[ ... ]
> +	ASSERT_EQ(create_file("/tmp/file"), 0);
> +	ret = fuse_backing_path(fuse_fd, "/tmp/file", O_PATH);
> +	if (ret == -EPERM)
> +		SKIP(return, "no fuse passthrough");
> +	EXPECT_EQ(ret, 0);

Is -EPERM the right errno to key the skip on?  On a kernel with
CONFIG_FUSE_FS=y and CONFIG_FUSE_PASSTHROUGH=n the test filesystem mounts
fine, and then fuse_dev_ioctl_backing_open() returns before any
permission check:

    if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
        return -EOPNOTSUPP;

-EPERM only comes from fuse_backing_open_file() when fc->passthrough is
clear or CAP_SYS_ADMIN is missing.  So here EXPECT_EQ(ret, 0) and the
later -EINVAL checks see -EOPNOTSUPP and fail, and the harness records
"not ok" for a feature that is not configured.  Kernels that predate
FUSE_DEV_IOC_BACKING_OPEN return -ENOTTY and fail the same way.

Should -EOPNOTSUPP (and possibly -ENOTTY) also lead to the SKIP?

[ ... ]

> +TEST(fuse_passthrough_overlayfs_metacopy_file)
[ ... ]
> +	ASSERT_EQ(create_file("/tmp/lower/file"), 0);
> +	ASSERT_EQ(setxattr("/tmp/lower/file", "trusted.overlay.metacopy",
> +			   "", 0, 0), 0);
> +	ASSERT_EQ(setxattr("/tmp/lower/file", "trusted.overlay.redirect",
> +			   "/missing", strlen("/missing"), 0), 0);

Can these setxattr() calls fail on a kernel without CONFIG_TMPFS_XATTR?

The private tmpfs from setup_tmp() has no xattr handlers in that case, so
setxattr() returns EOPNOTSUPP, the ASSERT_EQ() aborts, and the program
exits with a failure instead of KSFT_SKIP.  The mount of overlayfs just
below already has a SKIP for missing support.  Would a SKIP on
EOPNOTSUPP here, or CONFIG_TMPFS_XATTR=y in the config fragment, avoid
this?

> +	ret = fuse_backing_path(fuse_fd, "/tmp/file", O_PATH);
> +	if (ret == -EPERM)
> +		SKIP(return, "no fuse passthrough");
> +	ASSERT_EQ(ret, 0);

The same -EPERM check as in fuse_passthrough_backing_file() is used here,
so ASSERT_EQ(ret, 0) fails with -EOPNOTSUPP when CONFIG_FUSE_PASSTHROUGH
is off.

[ ... ]

> +TEST(fuse_passthrough_io)
[ ... ]
> +		srv.backing_ids[i] = fuse_backing_open(srv.fd, fd);
> +		EXPECT_EQ(close(fd), 0);
> +		if (srv.backing_ids[i] == -EPERM)
> +			SKIP(return, "no fuse passthrough");
> +		ASSERT_GT(srv.backing_ids[i], 0);

Does this skip also miss the unconfigured case?  With
CONFIG_FUSE_PASSTHROUGH=n, fuse_backing_open() gets -EOPNOTSUPP from the
ioctl, which is not -EPERM, so ASSERT_GT(srv.backing_ids[i], 0) fails and
run_one() records "not ok" for the whole pseudo_backing_test.  No fuse
server has been started at this point, so nothing hangs.  The config
fragment does list CONFIG_FUSE_PASSTHROUGH=y, but should -EOPNOTSUPP and
-ENOTTY also lead to SKIP(return, "no fuse passthrough") in all three fuse
tests?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/43858134663

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

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

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=56b5bed0bd75b5b0c7368009493734cda89f1ca37c0fc29c81ed65048cbfeca4@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=alex@amutable.com \
    --cc=amir73il@gmail.com \
    --cc=andrii@kernel.org \
    --cc=apparmor@lists.ubuntu.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=chris@chrisdown.name \
    --cc=daniel@iogearbox.net \
    --cc=driver-core@lists.linux.dev \
    --cc=eddyz87@gmail.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=ihor.solodrai@linux.dev \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.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=linuxppc-dev@lists.ozlabs.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=selinux@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®