kernel: allow root processes to get allow/deny list (#256)
This commit is contained in:
@@ -253,25 +253,8 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all other cmds are for 'root manager'
|
if (arg2 == CMD_GET_ALLOW_LIST || arg2 == CMD_GET_DENY_LIST) {
|
||||||
if (!is_manager()) {
|
if (is_manager() || 0 == current_uid().val) {
|
||||||
pr_info("Only manager can do cmd: %d\n", arg2);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we are already manager
|
|
||||||
if (arg2 == CMD_ALLOW_SU || arg2 == CMD_DENY_SU) {
|
|
||||||
bool allow = arg2 == CMD_ALLOW_SU;
|
|
||||||
bool success = false;
|
|
||||||
uid_t uid = (uid_t)arg3;
|
|
||||||
success = ksu_allow_uid(uid, allow, true);
|
|
||||||
if (success) {
|
|
||||||
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
|
|
||||||
pr_err("prctl reply error, cmd: %d\n", arg2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ksu_show_allow_list();
|
|
||||||
} else if (arg2 == CMD_GET_ALLOW_LIST || arg2 == CMD_GET_DENY_LIST) {
|
|
||||||
u32 array[128];
|
u32 array[128];
|
||||||
u32 array_length;
|
u32 array_length;
|
||||||
bool success = ksu_get_allow_list(array, &array_length,
|
bool success = ksu_get_allow_list(array, &array_length,
|
||||||
@@ -291,6 +274,27 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all other cmds are for 'root manager'
|
||||||
|
if (!is_manager()) {
|
||||||
|
pr_info("Only manager can do cmd: %d\n", arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we are already manager
|
||||||
|
if (arg2 == CMD_ALLOW_SU || arg2 == CMD_DENY_SU) {
|
||||||
|
bool allow = arg2 == CMD_ALLOW_SU;
|
||||||
|
bool success = false;
|
||||||
|
uid_t uid = (uid_t)arg3;
|
||||||
|
success = ksu_allow_uid(uid, allow, true);
|
||||||
|
if (success) {
|
||||||
|
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {
|
||||||
|
pr_err("prctl reply error, cmd: %d\n", arg2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ksu_show_allow_list();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user