kernel: load_allow_list when /data prepared

This commit is contained in:
weishu
2022-12-15 16:06:07 +07:00
parent c4b32332d2
commit 91f3b3ef1c
3 changed files with 21 additions and 6 deletions

View File

@@ -92,12 +92,20 @@ static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs) {
const char sh[] = SH_PATH;
const char su[] = SU_PATH;
if (!ksu_is_allow_uid(current_uid().val)) {
filename = PT_REGS_PARM2(regs);
if (IS_ERR(filename)) {
return 0;
}
filename = PT_REGS_PARM2(regs);
if (IS_ERR(filename)) {
static const char app_process[] = "/system/bin/app_process";
static bool first_app_process = true;
if (first_app_process && !memcmp(filename->name, app_process, sizeof(app_process) - 1)) {
first_app_process = false;
pr_info("exec app_process, /data prepared!\n");
ksu_load_allow_list();
}
if (!ksu_is_allow_uid(current_uid().val)) {
return 0;
}