security: commoncap: clarify CAP_FS_SET comment in cap_task_fix_setuid()
Subsystems (2)
PATCH v2 1/1 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.
---
v2: reword the comment to something more concise.
security/commoncap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
security/commoncap.c +6 -4
@@ -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 );
Signature · 1 line
2.51.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
CAP_FS_SETis exactly the set of capabilities that an fsuid of 0 historically granted (seeCAP_FS_MASKininclude/linux/capability.h), socap_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 <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 6 lines · Adriano Cordova
CAP_FS_SETis exactly the set of capabilities that an fsuid of 0 historically granted (seeCAP_FS_MASKininclude/linux/capability.h), socap_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 <[email protected]>
lgtm, thanks.
If I don't see objections soon, I can merge it into the caps-next tree.
thanks,
-serge
Quoted 30 lines
---
v2: reword the comment to something more concise.security/commoncap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)security/commoncap.c +6
-4@@ -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 );Signature · 1 line
2.51.0
Quoted 6 lines · Adriano Cordova
CAP_FS_SETis exactly the set of capabilities that an fsuid of 0 historically granted (seeCAP_FS_MASKininclude/linux/capability.h), socap_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 <[email protected]>
Hi,
so I had this in the caps-next branch, and was getting ready to send a PR... and was not feeling could about the new text. It's stating the obvious. Do you mind sending a new version that just drops the FIXME an ddoesn't add the new text?
Quoted 31 lines
---
v2: reword the comment to something more concise.security/commoncap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)security/commoncap.c +6
-4@@ -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 );Signature · 1 line
2.51.0