fix: sucompat (#2874)

Co-authored-by: Ylarod <me@ylarod.cn>
This commit is contained in:
ShirkNeko
2025-11-06 23:37:05 +08:00
parent c1ecb8f3b9
commit d416a0add7
2 changed files with 123 additions and 30 deletions

View File

@@ -1069,7 +1069,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
}
// disallow appuid decrease to any other uid if it is allowed to su
if (is_appuid(old_uid)) {
if (new_uid.val < old_uid.val && ksu_is_allow_uid_for_current(old_uid.val)) {
if (new_uid.val < old_uid.val && !ksu_is_allow_uid_for_current(old_uid.val)) {
pr_warn("find suspicious EoP: %d %s, from %d to %d\n",
current->pid, current->comm, old_uid.val, new_uid.val);
send_sig(SIGKILL, current, 0);
@@ -1229,7 +1229,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
}
// disallow appuid decrease to any other uid if it is allowed to su
if (is_appuid(old_uid)) {
if (new_uid.val < old_uid.val && ksu_is_allow_uid_for_current(old_uid.val)) {
if (new_uid.val < old_uid.val && !ksu_is_allow_uid_for_current(old_uid.val)) {
pr_warn("find suspicious EoP: %d %s, from %d to %d\n",
current->pid, current->comm, old_uid.val, new_uid.val);
send_sig(SIGKILL, current, 0);