kernel: Add optional full-user scanning capability using prctl

This commit is contained in:
ShirkNeko
2025-09-15 19:14:55 +08:00
parent 39c1b45257
commit a197600cb5
5 changed files with 211 additions and 74 deletions

View File

@@ -588,6 +588,34 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0;
}
if (arg2 == CMD_SCAN_ALL_USERS) {
if (!from_root && !from_manager) {
return 0;
}
// Get or Set scan_all_users
if (arg3 == 0) {
bool current_state = ksu_get_scan_all_users();
if (copy_to_user((void __user *)arg4, &current_state, sizeof(current_state))) {
pr_err("scan_all_users: copy current state failed\n");
return 0;
}
} else {
// Set new state (arg3 = 1: Enable, arg3 = 2: Disable)
bool new_state = (arg3 == 1);
if (ksu_set_scan_all_users(new_state)) {
pr_info("scan_all_users set to: %d\n", new_state);
} else {
pr_err("Failed to set scan_all_users to: %d\n", new_state);
return 0;
}
}
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("scan_all_users: prctl reply error\n");
}
return 0;
}
#ifdef CONFIG_KPM
// ADD: 添加KPM模块控制
if(sukisu_is_kpm_control_code(arg2)) {