kernel: Resolve compilation issues

This commit is contained in:
ShirkNeko
2025-11-06 14:50:46 +08:00
parent 54e1e3dda3
commit 3382574aad
7 changed files with 21 additions and 49 deletions

View File

@@ -22,21 +22,6 @@ config KSU_MULTI_MANAGER_SUPPORT
help help
Enable multi KernelSU manager support Enable multi KernelSU manager support
config KSU_THRONE_TRACKER_LEGACY
bool "Use legacy throne tracker (packages.list scanning)"
depends on KSU
default n
help
Use legacy throne tracker that scans packages.list for app UIDs.
This is kept for Ultra-Legacy Linux 4.4-3.X kernels which are prone to deadlocks.
Enable this if default scanning deadlocks/crashes on you.
config KSU_MANUAL_SU
bool "Use manual su"
depends on KSU
default y
help
Use manual su and authorize the corresponding command line and application via prctl
config KSU_ALLOWLIST_WORKAROUND config KSU_ALLOWLIST_WORKAROUND
bool "KernelSU Session Keyring Init workaround" bool "KernelSU Session Keyring Init workaround"
@@ -46,14 +31,6 @@ config KSU_ALLOWLIST_WORKAROUND
Enable session keyring init workaround for problematic devices. Enable session keyring init workaround for problematic devices.
Useful for situations where the SU allowlist is not kept after a reboot Useful for situations where the SU allowlist is not kept after a reboot
config KSU_CMDLINE
bool "Enable KernelSU cmdline"
depends on KSU && KSU != m
default n
help
Enable a cmdline called kernelsu.enabled
Value 1 means enabled, value 0 means disabled.
config KPM config KPM
bool "Enable SukiSU KPM" bool "Enable SukiSU KPM"
depends on KSU && 64BIT depends on KSU && 64BIT
@@ -65,25 +42,12 @@ config KPM
This option is suitable for scenarios where you need to force KPM to be enabled. This option is suitable for scenarios where you need to force KPM to be enabled.
but it may affect system stability. but it may affect system stability.
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
menu "KernelSU - SUSFS" menu "KernelSU - SUSFS"
config KSU_SUSFS config KSU_SUSFS
bool "KernelSU addon - SUSFS" bool "KernelSU addon - SUSFS"

View File

@@ -95,12 +95,13 @@ endif
ccflags-y += -DKSU_VERSION=$(KSU_VERSION) ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
ccflags-y += -DKSU_VERSION_FULL=\"$(KSU_VERSION_FULL)\" ccflags-y += -DKSU_VERSION_FULL=\"$(KSU_VERSION_FULL)\"
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

@@ -7,12 +7,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
/* /*
* Linux 6.8+ does not have LKM support, due to numerous changes on LSM. * Linux 6.8+ does not have LKM support, due to numerous changes on LSM.
* Let's fails if MODULE were defined. * Let's fails if MODULE were defined.

View File

@@ -20,6 +20,13 @@
#include <linux/susfs.h> #include <linux/susfs.h>
#endif #endif
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)
{ {
pr_info("kernelsu.enabled=%d\n", pr_info("kernelsu.enabled=%d\n",
@@ -45,6 +52,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();
@@ -72,6 +81,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));

View File

@@ -545,7 +545,7 @@ bool susfs_is_sus_su_hooks_enabled __read_mostly = false;
int susfs_sus_su_working_mode = 0; int susfs_sus_su_working_mode = 0;
static bool ksu_is_su_kps_enabled(void) { static bool ksu_is_su_kps_enabled(void) {
#ifdef CONFIG_KSU_KPROBES_HOOK #ifdef KSU_KPROBES_HOOK
destroy_kprobe(&pts_kp); destroy_kprobe(&pts_kp);
#endif #endif
return false; return false;