From 132e9ef8ed895cc01628543beba1f4cef563bfbe Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Thu, 6 Nov 2025 13:48:26 +0800 Subject: [PATCH] kernel: Resolve compilation issues --- .github/workflows/ddk-lkm.yml | 2 +- kernel/Kconfig | 13 ------------- kernel/Makefile | 11 ++++++----- kernel/allowlist.c | 2 +- kernel/kernel_compat.h | 6 ------ kernel/ksu.c | 12 ++++++++++++ kernel/ksu.h | 2 ++ 7 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ddk-lkm.yml b/.github/workflows/ddk-lkm.yml index dedfc8c2..2813ab1a 100644 --- a/.github/workflows/ddk-lkm.yml +++ b/.github/workflows/ddk-lkm.yml @@ -31,7 +31,7 @@ jobs: cd kernel echo "=== Building kernelsu.ko for KMI: ${{ inputs.kmi }} ===" - CONFIG_KSU=m CONFIG_KSU_TRACEPOINT_HOOK=y CONFIG_KSU_MANUAL_SU=y make + CONFIG_KSU=m CONFIG_KSU_MANUAL_SU=y make echo "=== Build completed ===" # Create output directory in GitHub workspace diff --git a/kernel/Kconfig b/kernel/Kconfig index 74ac8a12..fd5e0c11 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -33,23 +33,10 @@ config KPM select KALLSYMS select KALLSYMS_ALL -choice - prompt "KernelSU hook type" - depends on KSU - default KSU_TRACEPOINT_HOOK - -config KSU_TRACEPOINT_HOOK - bool "Hook KernelSU with Tracepoint" - depends on HAVE_SYSCALL_TRACEPOINTS - help - If enabled, Hook required KernelSU syscalls with Tracepoint. - config KSU_MANUAL_HOOK bool "Hook KernelSU manually" depends on KSU != m help If enabled, Hook required KernelSU syscalls with manually-patched function. -endchoice - endmenu diff --git a/kernel/Makefile b/kernel/Makefile index 2c0f27b7..8adc403b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -119,12 +119,13 @@ ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\" $(info -- SukiSU Manager package name: $(KSU_MANAGER_PACKAGE)) endif -ifeq ($(CONFIG_KSU_TRACEPOINT_HOOK), y) -$(info -- SukiSU: KSU_TRACEPOINT_HOOK) -ccflags-y += -DKSU_HAVE_SYSCALL_TRACEPOINTS_HOOK -else ifeq ($(CONFIG_KSU_MANUAL_HOOK), y) -$(info -- SukiSU: KSU_MANUAL_HOOK) +ifeq ($(CONFIG_KSU_MANUAL_HOOK), y) ccflags-y += -DKSU_MANUAL_HOOK +$(info -- SukiSU: KSU_MANUAL_HOOK) +else +ccflags-y += -DKSU_HAVE_SYSCALL_TRACEPOINTS_HOOK +ccflags-y += -DKSU_KPROBES_HOOK +$(info -- SukiSU: KSU_TRACEPOINT_HOOK) endif KERNEL_VERSION := $(VERSION).$(PATCHLEVEL) diff --git a/kernel/allowlist.c b/kernel/allowlist.c index 7b75d143..5ff14a5a 100644 --- a/kernel/allowlist.c +++ b/kernel/allowlist.c @@ -588,7 +588,7 @@ void ksu_temp_revoke_root_once(uid_t uid) strcpy(profile.rp_config.profile.selinux_domain, KSU_DEFAULT_SELINUX_DOMAIN); ksu_set_app_profile(&profile, false); - persistent_allow_list(); + save_allow_list(); pr_info("pending_root: UID=%d removed and persist updated\n", uid); } #endif \ No newline at end of file diff --git a/kernel/kernel_compat.h b/kernel/kernel_compat.h index bafc8611..671ce558 100644 --- a/kernel/kernel_compat.h +++ b/kernel/kernel_compat.h @@ -6,12 +6,6 @@ #include "ss/policydb.h" #include "linux/key.h" -#if defined(CONFIG_KPROBES) && !defined(KSU_MANUAL_HOOK) -#define KSU_KPROBES_HOOK 1 -#else -#define KSU_KPROBES_HOOK 0 -#endif - /* * Adapt to Huawei HISI kernel without affecting other kernels , * Huawei Hisi Kernel EBITMAP Enable or Disable Flag , diff --git a/kernel/ksu.c b/kernel/ksu.c index bf920f99..afca0bdc 100644 --- a/kernel/ksu.c +++ b/kernel/ksu.c @@ -17,6 +17,14 @@ #include "ksud.h" #include "supercalls.h" + +static struct workqueue_struct *ksu_workqueue; + +bool ksu_queue_work(struct work_struct *work) +{ + return queue_work(ksu_workqueue, work); +} + int __init kernelsu_init(void) { #ifdef CONFIG_KSU_DEBUG @@ -35,6 +43,8 @@ int __init kernelsu_init(void) ksu_core_init(); + ksu_workqueue = alloc_ordered_workqueue("kernelsu_work_queue", 0); + ksu_allowlist_init(); ksu_throne_tracker_init(); @@ -62,6 +72,8 @@ void kernelsu_exit(void) ksu_throne_tracker_exit(); + destroy_workqueue(ksu_workqueue); + #ifdef KSU_KPROBES_HOOK ksu_ksud_exit(); ksu_sucompat_exit(); diff --git a/kernel/ksu.h b/kernel/ksu.h index db750820..302fb935 100644 --- a/kernel/ksu.h +++ b/kernel/ksu.h @@ -95,6 +95,8 @@ struct app_profile { }; }; +bool ksu_queue_work(struct work_struct *work); + static inline int startswith(char *s, char *prefix) { return strncmp(s, prefix, strlen(prefix));