kernel: prevent root process to exec su, which makes app can escape root profile by exec it twice
This commit is contained in:
@@ -60,6 +60,10 @@ void escape_to_root(void)
|
|||||||
|
|
||||||
cred = (struct cred *)__task_cred(current);
|
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);
|
struct root_profile *profile = ksu_get_root_profile(cred->uid.val);
|
||||||
|
|
||||||
cred->uid.val = profile->uid;
|
cred->uid.val = profile->uid;
|
||||||
|
|||||||
Reference in New Issue
Block a user