summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriano Cordova <adrianox@gmail.com>2026-09-20 23:52:08 -0300
committerSerge Hallyn <sergeh@kernel.org>2026-09-25 09:54:56 -0500
commit507adb6448378155ec89495fed8c3c09d8c83920 (patch)
tree3208dc3ea235643c5e0585ea279fd01e9bf3d8ec
parent93f51579e7df248780214094418f205253383cc5 (diff)
downloadlinux-next-507adb6448378155ec89495fed8c3c09d8c83920.tar.gz
linux-next-507adb6448378155ec89495fed8c3c09d8c83920.zip
security: commoncap: clarify CAP_FS_SET comment in cap_task_fix_setuid()
CAP_FS_SET is exactly the set of capabilities that an fsuid of 0 historically granted (see CAP_FS_MASK in include/linux/capability.h), so cap_task_fix_setuid() drops that set from the effective set when fsuid leaves 0. Replace the stale FIXME with this explanation. Signed-off-by: Adriano Cordova <adrianox@gmail.com> Reviewed-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Serge Hallyn <sergeh@kernel.org>
-rw-r--r--security/commoncap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index 3399535808fe..1ba2ea2651fc 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -1169,11 +1169,13 @@ int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
break;
case LSM_SETID_FS:
- /* juggle the capabilities to follow FSUID changes, unless
- * otherwise suppressed
+ /* Juggle the capabilities to follow FSUID changes, unless
+ * otherwise suppressed.
*
- * FIXME - is fsuser used for all CAP_FS_MASK capabilities?
- * if not, we might be a bit too harsh here.
+ * CAP_FS_SET is exactly the set of capabilities that an
+ * fsuid of 0 historically granted (see CAP_FS_MASK in
+ * <linux/capability.h>), so we drop that set when fsuid
+ * leaves 0.
*/
if (!issecure(SECURE_NO_SETUID_FIXUP)) {
kuid_t root_uid = make_kuid(old->user_ns, 0);