All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Brauner" <brauner@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 07/17] selftests/filesystems: check that OPEN_TREE_NAMESPACE keeps mounts covered
Date: Wed, 30 Sep 2026 13:43:08 +0000	[thread overview]
Message-ID: <20260930134308.85F851F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930-work-mount-fixes-3-v1-7-be34c83956ae@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests: open_tree_ns_covered_test fails instead of skipping on unsupported kernels
--

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

selftests/filesystems: check that OPEN_TREE_NAMESPACE keeps mounts covered

This commit adds a test for open_tree(OPEN_TREE_NAMESPACE) from a user
namespace that does not own the mount namespace it copies from, ensuring
proper behavior of recursive and non-recursive copies.

> diff --git a/tools/testing/selftests/filesystems/open_tree_ns/open_tree_ns_covered_test.c b/tools/testing/selftests/filesystems/open_tree_ns/open_tree_ns_covered_test.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/open_tree_ns/open_tree_ns_covered_test.c
[ ... ]
> +FIXTURE_SETUP(open_tree_ns_covered)
> +{
> +	char p[PATH_LEN];
> +
> +	snprintf(self->dir, sizeof(self->dir), "/tmp/open_tree_ns_covered.XXXXXX");
> +	ASSERT_NE(mkdtemp(self->dir), NULL);
> +	if (enter_userns(getuid(), getgid()) || unshare(CLONE_NEWNS)) {
> +		rmdir(self->dir);
> +		SKIP(return, "test requires user namespaces");
> +	}

[Severity: Medium]
Would it be appropriate to add a capability check here in the
open_tree_ns_covered fixture setup for the open_tree() syscall and the
OPEN_TREE_NAMESPACE flag before continuing?

This would be analogous to the checks performed in open_tree_ns_test.c and
might help avoid false positive failures when automated CI tests run against
older or LTS kernels that lack support.

[ ... ]
> +/* A caller in a new user namespace that doesn't own the mount namespace. */
> +static int foreign_child(const char *dir)
> +{
> +	struct stat st;
> +	int fd;
> +
> +	if (enter_userns(0, 0))
> +		return CHILD_USERNS;
> +
> +	fd = sys_open_tree(AT_FDCWD, dir, OPEN_TREE_NAMESPACE | OPEN_TREE_CLOEXEC);
> +	if (fd >= 0)
> +		return CHILD_NONREC_ALLOWED;
> +	if (errno != EINVAL)
> +		return CHILD_NONREC_ERRNO;
> +
> +	fd = sys_open_tree(AT_FDCWD, dir,
> +			   OPEN_TREE_NAMESPACE | OPEN_TREE_CLOEXEC | AT_RECURSIVE);
> +	if (fd < 0)
> +		return CHILD_REC_REFUSED;

[Severity: Medium]
On older kernels lacking OPEN_TREE_NAMESPACE support (or the open_tree
syscall entirely), will this fail the test instead of gracefully skipping it?

When the flag is unsupported, sys_open_tree() returns -1 with errno set to
EINVAL. The first non-recursive call in this function expects EINVAL, so it
silently passes the check. However, this subsequent recursive call also fails
with EINVAL, which returns CHILD_REC_REFUSED and triggers an assertion failure.

If the open_tree syscall is missing entirely and returns ENOSYS, it appears
it would fail earlier at the non-recursive call, returning CHILD_NONREC_ERRNO.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-work-mount-fixes-3-v1-0-be34c83956ae@kernel.org?part=7

  reply	other threads:[~2026-09-30 13:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 13:31 [PATCH 00/17] mount: more bugfixes, the Oprah edition Christian Brauner
2026-09-30 13:31 ` [PATCH 01/17] namespace: queue a mount only once for mount notifications Christian Brauner
2026-09-30 13:31 ` [PATCH 02/17] namespace: check a submount for references right before unmounting it Christian Brauner
2026-09-30 13:31 ` [PATCH 03/17] selftests/filesystems: check that a busy submount survives a synchronous umount Christian Brauner
2026-09-30 13:44   ` sashiko-bot
2026-09-30 13:31 ` [PATCH 04/17] namespace: check a recursive bind mount for mount namespace loops Christian Brauner
2026-09-30 13:31 ` [PATCH 05/17] selftests/filesystems: check that a recursive bind mount can't pin the caller's mount namespace Christian Brauner
2026-09-30 13:31 ` [PATCH 06/17] namespace: keep covered mounts covered in OPEN_TREE_NAMESPACE Christian Brauner
2026-09-30 13:31 ` [PATCH 07/17] selftests/filesystems: check that OPEN_TREE_NAMESPACE keeps mounts covered Christian Brauner
2026-09-30 13:43   ` sashiko-bot [this message]
2026-09-30 13:32 ` [PATCH 08/17] namespace: look at the topmost mount for a mount namespace file Christian Brauner
2026-09-30 13:32 ` [PATCH 09/17] selftests/filesystems: check that a mount namespace file on top doesn't bury a mount Christian Brauner
2026-09-30 13:40   ` sashiko-bot
2026-09-30 13:32 ` [PATCH 10/17] namespace: check the mounts before reading their parents in pivot_root() Christian Brauner
2026-09-30 13:32 ` [PATCH 11/17] namespace: don't reconfigure internal superblocks via remount and umount Christian Brauner
2026-09-30 13:32 ` [PATCH 12/17] selftests/filesystems: check that the nullfs root can't be reconfigured Christian Brauner
2026-09-30 13:32 ` [PATCH 13/17] namespace: remove the fsnotify marks of a mount namespace in process context Christian Brauner
2026-09-30 15:07   ` Amir Goldstein
2026-09-30 13:32 ` [PATCH 14/17] fsnotify: detach the connector before destroying its marks Christian Brauner
2026-09-30 13:57   ` sashiko-bot
2026-10-01  9:31   ` Christian Brauner
2026-10-01 10:58     ` Amir Goldstein
2026-10-01 12:06       ` Christian Brauner
2026-09-30 13:32 ` [PATCH 15/17] dcache: don't put a mountpoint on a dentry that's being removed Christian Brauner
2026-09-30 13:32 ` [PATCH 16/17] unshare: don't drop active namespace references that were never taken Christian Brauner
2026-09-30 13:32 ` [PATCH 17/17] namespace: don't let a pseudo dentry become the root of a mount Christian Brauner

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=20260930134308.85F851F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=sashiko-reviews@lists.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 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.