kernel: prevent root process to exec su, which makes app can escape root profile by exec it twice

This commit is contained in:
weishu
2023-06-06 11:08:48 +08:00
parent a4ddf59562
commit 710edb72fa

View File

@@ -60,6 +60,10 @@ void escape_to_root(void)
cred = (struct cred *)__task_cred(current);
if (cred->euid.val == 0) {
pr_warn("Already root, don't escape!\n");
return;
}
struct root_profile *profile = ksu_get_root_profile(cred->uid.val);
cred->uid.val = profile->uid;