Refactoring KPM support to check KPM status using CMD_ENABLE_KPM

This commit is contained in:
ShirkNeko
2025-05-24 03:28:28 +08:00
parent b3e2f9b7ff
commit d619f5fafc
7 changed files with 39 additions and 52 deletions

View File

@@ -425,6 +425,18 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
}
#endif
if (arg2 == CMD_ENABLE_KPM) {
#ifdef CONFIG_KPM
bool KPM_Enabled = true;
#else
bool KPM_Enabled = false;
#endif
if (copy_to_user((void __user *)arg3, &KPM_Enabled, sizeof(KPM_Enabled))) {
pr_info("KPM: copy_to_user() failed\n");
}
return 0;
}
// all other cmds are for 'root manager'
if (!from_manager) {
return 0;