22#include <linux/fs.h>
33#include <linux/kobject.h>
44#include <linux/module.h>
5+ #include <generated/utsrelease.h>
6+ #include <generated/compile.h>
57#include <linux/version.h> /* LINUX_VERSION_CODE, KERNEL_VERSION macros */
68#include <linux/workqueue.h>
79
@@ -28,8 +30,87 @@ bool ksu_queue_work(struct work_struct *work)
2830
2931extern void ksu_supercalls_init ();
3032
33+ // track backports and other quirks here
34+ // ref: kernel_compat.c, Makefile
35+ // yes looks nasty
36+ #if defined(CONFIG_KSU_KPROBES_KSUD )
37+ #define FEAT_1 " +kprobes_ksud"
38+ #else
39+ #define FEAT_1 ""
40+ #endif
41+
42+ #if defined(CONFIG_KSU_KRETPROBES_SUCOMPAT )
43+ #define FEAT_2 " +kretprobes_sucompat"
44+ #else
45+ #define FEAT_2 ""
46+ #endif
47+ #if defined(CONFIG_KSU_THRONE_TRACKER_ALWAYS_THREADED )
48+ #define FEAT_3 " +throne_always_threaded"
49+ #else
50+ #define FEAT_3 ""
51+ #endif
52+ #if defined(CONFIG_KSU_EXTRAS )
53+ #define FEAT_4 " +extras"
54+ #else
55+ #define FEAT_4 ""
56+ #endif
57+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 2 , 0 ) && !defined(CONFIG_KSU_LSM_SECURITY_HOOKS )
58+ #define FEAT_5 " -lsm_hooks"
59+ #else
60+ #define FEAT_5 ""
61+ #endif
62+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 9 , 0 )) && defined(CONFIG_KSU_ALLOWLIST_WORKAROUND )
63+ #define FEAT_6 " +allowlist_workaround"
64+ #else
65+ #define FEAT_6 ""
66+ #endif
67+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 4 , 0 )) && defined(KSU_HAS_MODERN_EXT4 )
68+ #define FEAT_7 " +ext4_unregister_sysfs"
69+ #else
70+ #define FEAT_7 ""
71+ #endif
72+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 9 , 0 )) && defined(KSU_HAS_PATH_UMOUNT )
73+ #define FEAT_8 " +path_umount"
74+ #else
75+ #define FEAT_8 ""
76+ #endif
77+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 8 , 0 )) && defined(KSU_COPY_FROM_USER_NOFAULT )
78+ #define FEAT_9 " +copy_from_user_nofault"
79+ #else
80+ #define FEAT_9 ""
81+ #endif
82+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 3 , 0 )) && defined(KSU_PROBE_USER_READ )
83+ #define FEAT_10 " +probe_user_read"
84+ #else
85+ #define FEAT_10 ""
86+ #endif
87+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 )) && defined(KSU_NEW_KERNEL_READ )
88+ #define FEAT_11 " +new_kernel_read"
89+ #else
90+ #define FEAT_11 ""
91+ #endif
92+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 14 , 0 )) && defined(KSU_NEW_KERNEL_WRITE )
93+ #define FEAT_12 " +new_kernel_write"
94+ #else
95+ #define FEAT_12 ""
96+ #endif
97+ #if !(LINUX_VERSION_CODE >= KERNEL_VERSION (3 , 16 , 0 )) && defined(KSU_HAS_FOP_READ_ITER )
98+ #define FEAT_13 " +read_iter"
99+ #else
100+ #define FEAT_13 ""
101+ #endif
102+ #if LINUX_VERSION_CODE < KERNEL_VERSION (3 , 11 , 0 ) && defined(KSU_HAS_ITERATE_DIR )
103+ #define FEAT_14 " +iterate_dir"
104+ #else
105+ #define FEAT_14 ""
106+ #endif
107+
108+ #define EXTRA_FEATURES FEAT_1 FEAT_2 FEAT_3 FEAT_4 FEAT_5 FEAT_6 FEAT_7 FEAT_8 FEAT_9 FEAT_10 FEAT_11 FEAT_12 FEAT_13 FEAT_14
109+
31110int __init kernelsu_init (void )
32111{
112+ pr_info ("Initialized on: %s (%s) with ksuver: %s%s\n" , UTS_RELEASE , UTS_MACHINE , __stringify (KSU_VERSION ), EXTRA_FEATURES );
113+
33114#ifdef CONFIG_KSU_DEBUG
34115 pr_alert ("*************************************************************" );
35116 pr_alert ("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **" );
0 commit comments