kernel: Resolve compilation issues

This commit is contained in:
ShirkNeko
2025-11-06 13:48:26 +08:00
parent e6436b340c
commit 132e9ef8ed
7 changed files with 22 additions and 26 deletions

View File

@@ -31,7 +31,7 @@ jobs:
cd kernel cd kernel
echo "=== Building kernelsu.ko for KMI: ${{ inputs.kmi }} ===" 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 ===" echo "=== Build completed ==="
# Create output directory in GitHub workspace # Create output directory in GitHub workspace

View File

@@ -33,23 +33,10 @@ config KPM
select KALLSYMS select KALLSYMS
select KALLSYMS_ALL 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 config KSU_MANUAL_HOOK
bool "Hook KernelSU manually" bool "Hook KernelSU manually"
depends on KSU != m depends on KSU != m
help help
If enabled, Hook required KernelSU syscalls with manually-patched function. If enabled, Hook required KernelSU syscalls with manually-patched function.
endchoice
endmenu endmenu

View File

@@ -119,12 +119,13 @@ ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\"
$(info -- SukiSU Manager package name: $(KSU_MANAGER_PACKAGE)) $(info -- SukiSU Manager package name: $(KSU_MANAGER_PACKAGE))
endif endif
ifeq ($(CONFIG_KSU_TRACEPOINT_HOOK), y) ifeq ($(CONFIG_KSU_MANUAL_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)
ccflags-y += -DKSU_MANUAL_HOOK 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 endif
KERNEL_VERSION := $(VERSION).$(PATCHLEVEL) KERNEL_VERSION := $(VERSION).$(PATCHLEVEL)

View File

@@ -588,7 +588,7 @@ void ksu_temp_revoke_root_once(uid_t uid)
strcpy(profile.rp_config.profile.selinux_domain, KSU_DEFAULT_SELINUX_DOMAIN); strcpy(profile.rp_config.profile.selinux_domain, KSU_DEFAULT_SELINUX_DOMAIN);
ksu_set_app_profile(&profile, false); ksu_set_app_profile(&profile, false);
persistent_allow_list(); save_allow_list();
pr_info("pending_root: UID=%d removed and persist updated\n", uid); pr_info("pending_root: UID=%d removed and persist updated\n", uid);
} }
#endif #endif

View File

@@ -6,12 +6,6 @@
#include "ss/policydb.h" #include "ss/policydb.h"
#include "linux/key.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 , * Adapt to Huawei HISI kernel without affecting other kernels ,
* Huawei Hisi Kernel EBITMAP Enable or Disable Flag , * Huawei Hisi Kernel EBITMAP Enable or Disable Flag ,

View File

@@ -17,6 +17,14 @@
#include "ksud.h" #include "ksud.h"
#include "supercalls.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) int __init kernelsu_init(void)
{ {
#ifdef CONFIG_KSU_DEBUG #ifdef CONFIG_KSU_DEBUG
@@ -35,6 +43,8 @@ int __init kernelsu_init(void)
ksu_core_init(); ksu_core_init();
ksu_workqueue = alloc_ordered_workqueue("kernelsu_work_queue", 0);
ksu_allowlist_init(); ksu_allowlist_init();
ksu_throne_tracker_init(); ksu_throne_tracker_init();
@@ -62,6 +72,8 @@ void kernelsu_exit(void)
ksu_throne_tracker_exit(); ksu_throne_tracker_exit();
destroy_workqueue(ksu_workqueue);
#ifdef KSU_KPROBES_HOOK #ifdef KSU_KPROBES_HOOK
ksu_ksud_exit(); ksu_ksud_exit();
ksu_sucompat_exit(); ksu_sucompat_exit();

View File

@@ -95,6 +95,8 @@ struct app_profile {
}; };
}; };
bool ksu_queue_work(struct work_struct *work);
static inline int startswith(char *s, char *prefix) static inline int startswith(char *s, char *prefix)
{ {
return strncmp(s, prefix, strlen(prefix)); return strncmp(s, prefix, strlen(prefix));