#include #include #include #include #include #include #include "allowlist.h" #include "arch.h" #include "core_hook.h" #include "feature.h" #include "klog.h" // IWYU pragma: keep #include "ksu.h" #include "throne_tracker.h" #include "sucompat.h" #include "ksud.h" #include "supercalls.h" #ifdef CONFIG_KSU_SUSFS #include #endif int __init kernelsu_init(void) { pr_info("kernelsu.enabled=%d\n", (int)get_ksu_state()); #ifdef CONFIG_KSU_DEBUG pr_alert("*************************************************************"); pr_alert("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **"); pr_alert("** **"); pr_alert("** You are running KernelSU in DEBUG mode **"); pr_alert("** **"); pr_alert("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **"); pr_alert("*************************************************************"); #endif #ifdef CONFIG_KSU_SUSFS susfs_init(); #endif ksu_feature_init(); ksu_supercalls_init(); ksu_core_init(); ksu_allowlist_init(); ksu_throne_tracker_init(); #ifdef KSU_KPROBES_HOOK ksu_sucompat_init(); ksu_ksud_init(); #else pr_debug("init ksu driver\n"); #endif #ifdef MODULE #ifndef CONFIG_KSU_DEBUG kobject_del(&THIS_MODULE->mkobj.kobj); #endif #endif return 0; } void kernelsu_exit(void) { ksu_allowlist_exit(); ksu_observer_exit(); ksu_throne_tracker_exit(); #ifdef KSU_KPROBES_HOOK ksu_ksud_exit(); ksu_sucompat_exit(); #endif ksu_sucompat_exit(); ksu_core_exit(); ksu_feature_exit(); } module_init(kernelsu_init); module_exit(kernelsu_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("weishu"); MODULE_DESCRIPTION("Android KernelSU"); #define VFS_NS_NAME VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0) MODULE_IMPORT_NS("VFS_NS_NAME"); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) MODULE_IMPORT_NS(VFS_NS_NAME); #endif