diff --git a/kernel/core_hook.c b/kernel/core_hook.c index cf44fa3f..c8690f04 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -413,6 +413,17 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3, return 0; } + if (arg2 == CMD_GET_MANAGER_UID) { + uid_t manager_uid = ksu_get_manager_uid(); + if (copy_to_user(arg3, &manager_uid, sizeof(manager_uid))) { + pr_err("get manager uid failed\n"); + } + if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) { + pr_err("prctl reply error, cmd: %lu\n", arg2); + } + return 0; + } + // all other cmds are for 'root manager' if (!from_manager) { return 0; diff --git a/kernel/ksu.h b/kernel/ksu.h index e5050024..75a0d9aa 100644 --- a/kernel/ksu.h +++ b/kernel/ksu.h @@ -23,6 +23,7 @@ #define CMD_UID_SHOULD_UMOUNT 13 #define CMD_IS_SU_ENABLED 14 #define CMD_ENABLE_SU 15 +#define CMD_GET_MANAGER_UID 16 #define EVENT_POST_FS_DATA 1 #define EVENT_BOOT_COMPLETED 2