From: Bhavik Sachdev <b.sachdev1904@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Shuah Khan <shuah@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, criu@lists.linux.dev,
Jan Kara <jack@suse.cz>, Jeff Layton <jlayton@kernel.org>,
Aleksa Sarai <cyphar@cyphar.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Bhavik Sachdev <b.sachdev1904@gmail.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Andrei Vagin <avagin@gmail.com>,
Alexander Mikhalitsyn <alexander@mihalicyn.com>,
John Hubbard <jhubbard@nvidia.com>,
Amir Goldstein <amir73il@gmail.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Andrew Donnellan <ajd@linux.ibm.com>
Subject: [PATCH v7 1/3] statmount: permission check should return EPERM
Date: Sat, 29 Nov 2025 14:41:20 +0530 [thread overview]
Message-ID: <20251129091455.757724-2-b.sachdev1904@gmail.com> (raw)
In-Reply-To: <20251129091455.757724-1-b.sachdev1904@gmail.com>
Currently, statmount() returns ENOENT when caller is not CAP_SYS_ADMIN
in the user namespace owner of target mount namespace. This should be
EPERM instead.
Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
---
fs/namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 2bad25709b2c..ee36d67f1ac2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5795,7 +5795,7 @@ SYSCALL_DEFINE4(statmount, const struct mnt_id_req __user *, req,
if (kreq.mnt_ns_id && (ns != current->nsproxy->mnt_ns) &&
!ns_capable_noaudit(ns->user_ns, CAP_SYS_ADMIN))
- return -ENOENT;
+ return -EPERM;
ks = kmalloc(sizeof(*ks), GFP_KERNEL_ACCOUNT);
if (!ks)
--
2.52.0
next prev parent reply other threads:[~2025-11-29 9:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-29 9:11 [PATCH v7 0/3] statmount: accept fd as a parameter Bhavik Sachdev
2025-11-29 9:11 ` Bhavik Sachdev [this message]
2025-11-29 9:11 ` [PATCH v7 2/3] " Bhavik Sachdev
2025-12-02 15:52 ` Andrei Vagin
2025-11-29 9:11 ` [PATCH v7 3/3] selftests: statmount: tests for STATMOUNT_BY_FD Bhavik Sachdev
2025-12-04 9:55 ` [PATCH v7 0/3] statmount: accept fd as a parameter Christian Brauner
2025-12-04 14:11 ` Jeff Layton
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=20251129091455.757724-2-b.sachdev1904@gmail.com \
--to=b.sachdev1904@gmail.com \
--cc=ajd@linux.ibm.com \
--cc=alexander@mihalicyn.com \
--cc=amir73il@gmail.com \
--cc=avagin@gmail.com \
--cc=brauner@kernel.org \
--cc=criu@lists.linux.dev \
--cc=cyphar@cyphar.com \
--cc=jack@suse.cz \
--cc=jhubbard@nvidia.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=miklos@szeredi.hu \
--cc=ptikhomirov@virtuozzo.com \
--cc=shuah@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;
as well as URLs for NNTP newsgroup(s).