capability: Remove unused has_capability
Subsystems (2)
PATCH v2 1/1 capability: Remove unused has_capability
From: "Dr. David Alan Gilbert" <[email protected]>
The vanilla has_capability() function has been unused since 2018's commit dcb569cf6ac9 ("Smack: ptrace capability use fixes")
Remove it.
Fixup a comment in security/commoncap.c that referenced it.
--- include/linux/capability.h | 5 ----- kernel/capability.c | 16 ---------------- security/commoncap.c | 9 +++++---- 3 files changed, 5 insertions(+), 25 deletions(-)
include/linux/capability.h +0 -5
@@ -139,7 +139,6 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a, }#ifdef CONFIG_MULTIUSER -extern bool has_capability (struct task_struct *t,int cap);extern bool has_ns_capability (struct task_struct *t,struct user_namespace *ns,int cap);extern bool has_capability_noaudit (struct task_struct *t,int cap);
@@ -150,10 +149,6 @@ extern bool ns_capable(struct user_namespace *ns, int cap);extern bool ns_capable_noaudit (struct user_namespace *ns,int cap);extern bool ns_capable_setid (struct user_namespace *ns,int cap);#else -static inline bool has_capability (struct task_struct *t,int cap) -{ -return true; -}static inline bool has_ns_capability (struct task_struct *t,struct user_namespace *ns,int cap) {
kernel/capability.c +0 -16
@@ -289,22 +289,6 @@ bool has_ns_capability(struct task_struct *t,return (ret ==0 ); } -/** -* has_capability - Does a task have a capability in init_user_ns -* @t: The task in question -* @cap: The capability to be tested for -* -* Return true if the specified task has the given superior capability -* currently in effect to the initial user namespace, false if not. -* -* Note that this does not set PF_SUPERPRIV on the task. -*/ -bool has_capability (struct task_struct *t,int cap) -{ -return has_ns_capability (t, &init_user_ns, cap); -} -EXPORT_SYMBOL (has_capability); -/** * has_ns_capability_noaudit - Does a task have a capability (unaudited) * in a specific user ns.
security/commoncap.c +5 -4
@@ -59,10 +59,11 @@ static void warn_setuid_and_fcaps_mixed(const char *fname)* Determine whether the nominated task has the specified capability amongst * its effective set, returning 0 if it does, -ve if it does not. * -* NOTE WELL: cap_has_capability() cannot be used like the kernel's capable() -* and has_capability() functions. That is, it has the reverse semantics: -* cap_has_capability() returns 0 when a task has a capability, but the -* kernel's capable() and has_capability() returns 1 for this case. +* NOTE WELL: cap_capable() has reverse semantics to the capable() call +* and friends. That is cap_capable() returns an int 0 when a task has +* a capability, while the kernel's capable(), has_ns_capability(), +* has_ns_capability_noaudit(), and has_capability_noaudit() return a +* bool true (1) for this case. */ int cap_capable (const struct cred *cred,struct user_namespace *targ_ns,int cap,unsigned int opts)
Signature · 1 line
2.47.1
Quoted 8 lines · On Thu, Dec 19, 2024 at 12:29 PM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The vanilla
has_capability()function has been unused since 2018's commitdcb569cf6ac9("Smack: ptrace capability use fixes")Remove it.
Quoted 8 lines
Fixup a comment in
security/commoncap.cthat referenced it.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- include/linux/capability.h | 5 ----- kernel/capability.c | 16 ---------------- security/commoncap.c | 9 +++++---- 3 files changed, 5 insertions(+), 25 deletions(-)
Now that Serge has the capabilities tree back up and running I'm assuming he will grab this patch, if not just let me know Serge and I can take it.
Signature · 1 line
paul-moore.com
Paul Moore
maintainerQuoted 19 lines · Paul Moore
Quoted 8 lines · On Thu, Dec 19, 2024 at 12:29 PM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The vanilla
has_capability()function has been unused since 2018's commitdcb569cf6ac9("Smack: ptrace capability use fixes")Remove it.
Quoted 8 lines
Fixup a comment in
security/commoncap.cthat referenced it.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- include/linux/capability.h | 5 ----- kernel/capability.c | 16 ---------------- security/commoncap.c | 9 +++++---- 3 files changed, 5 insertions(+), 25 deletions(-)
Quoted 5 lines
Now that Serge has the capabilities tree back up and running I'm assuming he will grab this patch, if not just let me know Serge and I can take it.
Reviewed-by Paul Moore <[email protected]>
Bump this thread to make sure Serge sees it ...
Signature · 1 line
paul-moore.com
[email protected]
Acked-by Serge HallynQuoted 20 lines · Paul Moore
Quoted 19 lines · Paul Moore
Quoted 16 lines · On Thu, Dec 19, 2024 at 12:29 PM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The vanilla
has_capability()function has been unused since 2018's commitdcb569cf6ac9("Smack: ptrace capability use fixes")Remove it.
Fixup a comment in
security/commoncap.cthat referenced it.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- include/linux/capability.h | 5 ----- kernel/capability.c | 16 ---------------- security/commoncap.c | 9 +++++---- 3 files changed, 5 insertions(+), 25 deletions(-)
Quoted 7 lines
Quoted 5 lines
Now that Serge has the capabilities tree back up and running I'm assuming he will grab this patch, if not just let me know Serge and I can take it.
Reviewed-by Paul Moore <[email protected]>Bump this thread to make sure Serge sees it ...
d'oh, sorry, yes
I will apply this now.
-serge
Quoted 27 lines · * [email protected] ([email protected]) wrote:
Quoted 26 lines · Paul Moore
Quoted 24 lines · Paul Moore
Quoted 8 lines · On Thu, Dec 19, 2024 at 12:29 PM <[email protected]> wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The vanilla
has_capability()function has been unused since 2018's commitdcb569cf6ac9("Smack: ptrace capability use fixes")Remove it.
Quoted 8 lines
Fixup a comment in
security/commoncap.cthat referenced it.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- include/linux/capability.h | 5 ----- kernel/capability.c | 16 ---------------- security/commoncap.c | 9 +++++---- 3 files changed, 5 insertions(+), 25 deletions(-)Now that Serge has the capabilities tree back up and running I'm assuming he will grab this patch, if not just let me know Serge and I can take it.
Reviewed-by Paul Moore <[email protected]>
Quoted 7 lines
Quoted 1 line
Bump this thread to make sure Serge sees it ...
d'oh, sorry, yes
Acked-by Serge Hallyn <[email protected]>I will apply this now.
Thanks!
Dave
Quoted 1 line
-serge
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/