kernel: press KEY_VOLUMEDOWN over 2 seconds will enter safemode and disable all modules

Co-authored-by: Ylarod <me@ylarod.cn>
This commit is contained in:
weishu
2023-02-13 21:23:18 +07:00
parent 20ff530962
commit ca950d909b
4 changed files with 142 additions and 4 deletions

View File

@@ -243,6 +243,16 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
return 0;
}
if (arg2 == CMD_CHECK_SAFEMODE) {
if (ksu_is_safe_mode()) {
pr_warn("safemode enabled!\n");
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
pr_err("safemode: prctl reply error\n");
}
}
return 0;
}
// all other cmds are for 'root manager'
if (!is_manager()) {
pr_info("Only manager can do cmd: %d\n", arg2);