From: Bhavik Sachdev <b.sachdev1904@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
criu@lists.linux.dev, Aleksa Sarai <cyphar@cyphar.com>,
Bhavik Sachdev <b.sachdev1904@gmail.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Jan Kara <jack@suse.cz>, John Garry <john.g.garry@oracle.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"Darrick J . Wong" <djwong@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ingo Molnar <mingo@kernel.org>, Andrei Vagin <avagin@gmail.com>,
Alexander Mikhalitsyn <alexander@mihalicyn.com>,
Miklos Szeredi <miklos@szeredi.hu>
Subject: [PATCH v6 1/2] statmount: permission check should return EPERM
Date: Tue, 18 Nov 2025 14:16:41 +0530 [thread overview]
Message-ID: <20251118084836.2114503-2-b.sachdev1904@gmail.com> (raw)
In-Reply-To: <20251118084836.2114503-1-b.sachdev1904@gmail.com>
Currently, statmount() returns ENOENT when caller is not CAP_SYS_ADMIN
in the current user 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.51.1
next prev parent reply other threads:[~2025-11-18 8:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 8:46 [PATCH v6 0/2] statmount: accept fd as a parameter Bhavik Sachdev
2025-11-18 8:46 ` Bhavik Sachdev [this message]
2025-11-18 8:46 ` [PATCH v6 2/2] " Bhavik Sachdev
2025-11-19 17:20 ` Andrei Vagin
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=20251118084836.2114503-2-b.sachdev1904@gmail.com \
--to=b.sachdev1904@gmail.com \
--cc=acme@redhat.com \
--cc=alexander@mihalicyn.com \
--cc=avagin@gmail.com \
--cc=brauner@kernel.org \
--cc=criu@lists.linux.dev \
--cc=cyphar@cyphar.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=john.g.garry@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=ptikhomirov@virtuozzo.com \
--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