kernel: Use CONFIG_KSU_MANUAL_SU to protect MANUAL_SU

This commit is contained in:
ShirkNeko
2025-11-05 16:17:54 +08:00
parent 557e7f8153
commit 994fdfddf2
3 changed files with 15 additions and 5 deletions

View File

@@ -33,10 +33,11 @@ static bool system_uid(uid_t uid)
return caller_uid <= 2000;
}
#ifdef CONFIG_KSU_MANUAL_SU
// Manual SU
static int handle_manual_su(struct sk_buff *skb, struct nlmsghdr *nlh, void *msg_data)
{
struct ksu_netlink_manual_su *msg = (struct ksu_netlink_manual_su *)msg_data;
struct netlink_manual_su *msg = (struct netlink_manual_su *)msg_data;
struct manual_su_request request;
int res;
@@ -61,17 +62,20 @@ static int handle_manual_su(struct sk_buff *skb, struct nlmsghdr *nlh, void *msg
return 0;
}
#endif
// Command handlers mapping table
static const struct ksu_netlink_cmd_handler ksu_netlink_handlers[] = {
#ifdef CONFIG_KSU_MANUAL_SU
{
.cmd = KSU_NETLINK_CMD_MANUAL_SU,
.msg_size = sizeof(struct ksu_netlink_manual_su),
.msg_size = sizeof(struct netlink_manual_su),
.name = "MANUAL_SU",
.handler = handle_manual_su,
.perm_check = system_uid
},
{ .cmd = 0, .name = NULL, .handler = NULL, .perm_check = NULL }
#endif
{ .cmd = 0, .msg_size = NULL, .name = NULL, .handler = NULL, .perm_check = NULL }
};
static void ksu_netlink_recv_msg(struct sk_buff *skb)