kernel: opt allowlist persist and log (#119)

* kernel: persist on need

* kernel: opt log for ksu_allow_uid
This commit is contained in:
Ylarod
2023-01-26 08:55:27 +08:00
committed by GitHub
parent 06aaae1335
commit 22b66b6672
3 changed files with 23 additions and 10 deletions

View File

@@ -184,7 +184,7 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
} else {
pr_info("deny root for: %d\n", current_uid());
// add it to deny list!
ksu_allow_uid(current_uid().val, false);
ksu_allow_uid(current_uid().val, false, true);
}
return 0;
}
@@ -211,12 +211,13 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
bool allow = arg2 == CMD_ALLOW_SU;
bool success = false;
uid_t uid = (uid_t)arg3;
success = ksu_allow_uid(uid, allow);
success = ksu_allow_uid(uid, allow, true);
if (success) {
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("prctl reply error, cmd: %d\n", arg2);
}
}
ksu_show_allow_list();
} else if (arg2 == CMD_GET_ALLOW_LIST || arg2 == CMD_GET_DENY_LIST) {
u32 array[128];
u32 array_length;