[PATCH 03/13] signal: use cred_ids_allow_signal()
Josef Bacik
josef at toxicpanda.com
Sun Oct 18 17:31:45 UTC 2026
kill_ok_by_cred() and kill_as_cred_perm() have the same four comparisons
each. Use the library.
No functional change.
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef at toxicpanda.com>
---
kernel/signal.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index e433de93b430..bdca8f9e0fbd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -791,10 +791,7 @@ static bool kill_ok_by_cred(struct task_struct *t)
const struct cred *cred = current_cred();
const struct cred *tcred = __task_cred(t);
- return uid_eq(cred->euid, tcred->suid) ||
- uid_eq(cred->euid, tcred->uid) ||
- uid_eq(cred->uid, tcred->suid) ||
- uid_eq(cred->uid, tcred->uid) ||
+ return cred_ids_allow_signal(cred, tcred) ||
ns_capable(tcred->user_ns, CAP_KILL);
}
@@ -1530,10 +1527,7 @@ static inline bool kill_as_cred_perm(const struct cred *cred,
{
const struct cred *pcred = __task_cred(target);
- return uid_eq(cred->euid, pcred->suid) ||
- uid_eq(cred->euid, pcred->uid) ||
- uid_eq(cred->uid, pcred->suid) ||
- uid_eq(cred->uid, pcred->uid);
+ return cred_ids_allow_signal(cred, pcred);
}
/*
--
2.55.0
More information about the Linux-security-module-archive
mailing list