Refactoring KPM support to check KPM status using CMD_ENABLE_KPM

This commit is contained in:
ShirkNeko
2025-05-24 14:36:41 +08:00
parent fe305e4219
commit bbb072b776
2 changed files with 7 additions and 0 deletions

View File

@@ -525,6 +525,12 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0;
}
#endif
if (arg2 == CMD_ENABLE_KPM) {
bool KPM_Enabled = IS_ENABLED(CONFIG_KPM);
if (copy_to_user((void __user *)arg3, &KPM_Enabled, sizeof(KPM_Enabled)))
pr_info("KPM: copy_to_user() failed\n");
return 0;
}
#ifdef CONFIG_KSU_SUSFS
if (current_uid_val == 0) {

View File

@@ -23,6 +23,7 @@
#define CMD_UID_SHOULD_UMOUNT 13
#define CMD_IS_SU_ENABLED 14
#define CMD_ENABLE_SU 15
#define CMD_ENABLE_KPM 100
#define EVENT_POST_FS_DATA 1
#define EVENT_BOOT_COMPLETED 2