From 931ababd148cd5b6e4bfe12e6b134d1191626e52 Mon Sep 17 00:00:00 2001 From: AlexLiuDev233 Date: Sat, 1 Mar 2025 15:59:18 +0800 Subject: [PATCH] kernel: fix sometimes sucompat can not toggle by manager (#2484) When the manager is already running, if other programs / kernel toggle the sucompat enable status, The manager "Disable SU Compat" toggle button can not work, kmesg print "cmd enable su but no need to change." I think we should still return reply_ok when the syscall value is consistent with the kernel, which would fix the issue. --- kernel/core_hook.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index db77e774..76282a94 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -470,6 +470,9 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3, bool enabled = (arg3 != 0); if (enabled == ksu_su_compat_enabled) { pr_info("cmd enable su but no need to change.\n"); + if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {// return the reply_ok directly + pr_err("prctl reply error, cmd: %lu\n", arg2); + } return 0; }