linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pid: use ns_capable_noaudit() when determining net sysctl permissions
@ 2025-09-10 19:26 Christian Göttsche
  2025-09-11 20:46 ` Paul Moore
  2025-09-19 11:08 ` Christian Brauner
  0 siblings, 2 replies; 8+ messages in thread
From: Christian Göttsche @ 2025-09-10 19:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Christian Göttsche, Christian Brauner, linux-security-module,
	selinux

From: Christian Göttsche <cgzones@googlemail.com>

The capability check should not be audited since it is only being used
to determine the inode permissions. A failed check does not indicate a
violation of security policy but, when an LSM is enabled, a denial audit
message was being generated.

The denial audit message can either lead to the capability being
unnecessarily allowed in a security policy, or being silenced potentially
masking a legitimate capability check at a later point in time.

Similar to commit d6169b0206db ("net: Use ns_capable_noaudit() when
determining net sysctl permissions")

Fixes: 7863dcc72d0f ("pid: allow pid_max to be set per pid namespace")
CC: Christian Brauner <brauner@kernel.org>
CC: linux-security-module@vger.kernel.org
CC: selinux@vger.kernel.org
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 kernel/pid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/pid.c b/kernel/pid.c
index c45a28c16cd2..d94ce0250501 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -680,7 +680,7 @@ static int pid_table_root_permissions(struct ctl_table_header *head,
 		container_of(head->set, struct pid_namespace, set);
 	int mode = table->mode;
 
-	if (ns_capable(pidns->user_ns, CAP_SYS_ADMIN) ||
+	if (ns_capable_noaudit(pidns->user_ns, CAP_SYS_ADMIN) ||
 	    uid_eq(current_euid(), make_kuid(pidns->user_ns, 0)))
 		mode = (mode & S_IRWXU) >> 6;
 	else if (in_egroup_p(make_kgid(pidns->user_ns, 0)))
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-09-19 11:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-10 19:26 [PATCH] pid: use ns_capable_noaudit() when determining net sysctl permissions Christian Göttsche
2025-09-11 20:46 ` Paul Moore
2025-09-11 23:05   ` Serge E. Hallyn
2025-09-12 19:35     ` Serge E. Hallyn
2025-09-15 14:13       ` Christian Brauner
2025-09-15 14:50         ` Serge E. Hallyn
2025-09-15 17:13         ` Serge E. Hallyn
2025-09-19 11:08 ` Christian Brauner

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).