@@ -47,15 +47,9 @@ static void stop_vfs_read_hook();
4747static void stop_execve_hook ();
4848static void stop_input_hook ();
4949
50- #ifdef CONFIG_KPROBES
5150static struct work_struct stop_vfs_read_work ;
5251static struct work_struct stop_execve_hook_work ;
5352static struct work_struct stop_input_hook_work ;
54- #else
55- bool ksu_vfs_read_hook __read_mostly = true;
56- bool ksu_execveat_hook __read_mostly = true;
57- bool ksu_input_hook __read_mostly = true;
58- #endif
5953
6054u32 ksu_devpts_sid ;
6155
@@ -150,11 +144,6 @@ int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr,
150144 struct user_arg_ptr * argv ,
151145 struct user_arg_ptr * envp , int * flags )
152146{
153- #ifndef CONFIG_KPROBES
154- if (!ksu_execveat_hook ) {
155- return 0 ;
156- }
157- #endif
158147 struct filename * filename ;
159148
160149 static const char app_process [] = "/system/bin/app_process" ;
@@ -306,11 +295,6 @@ static ssize_t read_iter_proxy(struct kiocb *iocb, struct iov_iter *to)
306295int ksu_handle_vfs_read (struct file * * file_ptr , char __user * * buf_ptr ,
307296 size_t * count_ptr , loff_t * * pos )
308297{
309- #ifndef CONFIG_KPROBES
310- if (!ksu_vfs_read_hook ) {
311- return 0 ;
312- }
313- #endif
314298 struct file * file ;
315299 char __user * buf ;
316300 size_t count ;
@@ -419,11 +403,6 @@ static bool is_volumedown_enough(unsigned int count)
419403int ksu_handle_input_handle_event (unsigned int * type , unsigned int * code ,
420404 int * value )
421405{
422- #ifndef CONFIG_KPROBES
423- if (!ksu_input_hook ) {
424- return 0 ;
425- }
426- #endif
427406 if (* type == EV_KEY && * code == KEY_VOLUMEDOWN ) {
428407 int val = * value ;
429408 pr_info ("KEY_VOLUMEDOWN val: %d\n" , val );
@@ -461,8 +440,6 @@ bool ksu_is_safe_mode()
461440 return false;
462441}
463442
464- #ifdef CONFIG_KPROBES
465-
466443static int sys_execve_handler_pre (struct kprobe * p , struct pt_regs * regs )
467444{
468445 struct pt_regs * real_regs = PT_REAL_REGS (regs );
@@ -515,7 +492,6 @@ static struct kprobe vfs_read_kp = {
515492 .pre_handler = sys_read_handler_pre ,
516493};
517494
518-
519495static struct kprobe input_event_kp = {
520496 .symbol_name = "input_event" ,
521497 .pre_handler = input_handle_event_handler_pre ,
@@ -535,28 +511,17 @@ static void do_stop_input_hook(struct work_struct *work)
535511{
536512 unregister_kprobe (& input_event_kp );
537513}
538- #endif
539514
540515static void stop_vfs_read_hook ()
541516{
542- #ifdef CONFIG_KPROBES
543517 bool ret = schedule_work (& stop_vfs_read_work );
544518 pr_info ("unregister vfs_read kprobe: %d!\n" , ret );
545- #else
546- ksu_vfs_read_hook = false;
547- pr_info ("stop vfs_read_hook\n" );
548- #endif
549519}
550520
551521static void stop_execve_hook ()
552522{
553- #ifdef CONFIG_KPROBES
554523 bool ret = schedule_work (& stop_execve_hook_work );
555524 pr_info ("unregister execve kprobe: %d!\n" , ret );
556- #else
557- ksu_execveat_hook = false;
558- pr_info ("stop execve_hook\n" );
559- #endif
560525}
561526
562527static void stop_input_hook ()
@@ -566,19 +531,13 @@ static void stop_input_hook()
566531 return ;
567532 }
568533 input_hook_stopped = true;
569- #ifdef CONFIG_KPROBES
570534 bool ret = schedule_work (& stop_input_hook_work );
571535 pr_info ("unregister input kprobe: %d!\n" , ret );
572- #else
573- ksu_input_hook = false;
574- pr_info ("stop input_hook\n" );
575- #endif
576536}
577537
578538// ksud: module support
579539void ksu_ksud_init ()
580540{
581- #ifdef CONFIG_KPROBES
582541 int ret ;
583542
584543 ret = register_kprobe (& execve_kp );
@@ -593,15 +552,12 @@ void ksu_ksud_init()
593552 INIT_WORK (& stop_vfs_read_work , do_stop_vfs_read_hook );
594553 INIT_WORK (& stop_execve_hook_work , do_stop_execve_hook );
595554 INIT_WORK (& stop_input_hook_work , do_stop_input_hook );
596- #endif
597555}
598556
599557void ksu_ksud_exit ()
600558{
601- #ifdef CONFIG_KPROBES
602559 unregister_kprobe (& execve_kp );
603560 // this should be done before unregister vfs_read_kp
604561 // unregister_kprobe(&vfs_read_kp);
605562 unregister_kprobe (& input_event_kp );
606- #endif
607563}
0 commit comments