[FIX] not set retprobes for sys_exit_group and do_group_exit
authorNikita Kalyazin <n.kalyazin@samsung.com>
Tue, 23 Apr 2013 08:32:27 +0000 (12:32 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Tue, 23 Apr 2013 08:32:27 +0000 (12:32 +0400)
Related to f8fa40b9f377164f117eeec47832b5b3351b4ec5, where retprobe for
do_exit is not set.
These functions do not return by design (contain NOTREACHED comment),
so we do not need to set retprobes for them.

kprobe/arch/dbi_kprobes.c
kprobe/dbi_kprobes.c
kprobe/dbi_kprobes_deps.c
kprobe/dbi_kprobes_deps.h

index 18ea8a5..3b6cac5 100644 (file)
@@ -107,10 +107,14 @@ int arch_init_module_dependencies(void)
        sched_addr = swap_ksyms("__switch_to");
        fork_addr = swap_ksyms("do_fork");
        exit_addr = swap_ksyms("do_exit");
+       sys_exit_group_addr = swap_ksyms("sys_exit_group");
+       do_group_exit_addr = swap_ksyms("do_group_exit");
 
        if ((void *)sched_addr == NULL ||
-                               (void *)fork_addr == NULL ||
-                               (void *)exit_addr == NULL) {
+           (void *)fork_addr == NULL ||
+           (void *)exit_addr == NULL ||
+           (void *)sys_exit_group_addr == NULL ||
+           (void *)do_group_exit_addr == NULL) {
                return -ESRCH;
        }
 
index 2502ef5..3ef525d 100644 (file)
@@ -707,6 +707,12 @@ int dbi_register_kretprobe (struct kretprobe *rp)
        } else if ((unsigned long)rp->kp.addr == exit_addr) {
                rp->kp.pre_handler = NULL; //not needed for do_exit
                rp->maxactive = 0;
+       } else if ((unsigned long)rp->kp.addr == do_group_exit_addr) {
+               rp->kp.pre_handler = NULL;
+               rp->maxactive = 0;
+       } else if ((unsigned long)rp->kp.addr == sys_exit_group_addr) {
+               rp->kp.pre_handler = NULL;
+               rp->maxactive = 0;
        } else if (rp->maxactive <= 0) {
 #if 1//def CONFIG_PREEMPT
                rp->maxactive = max (COMMON_RP_NR, 2 * NR_CPUS);
index 09a815f..1c198bb 100644 (file)
@@ -39,6 +39,8 @@
 unsigned long sched_addr;
 unsigned long fork_addr;
 unsigned long exit_addr;
+unsigned long sys_exit_group_addr;
+unsigned long do_group_exit_addr;
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29)
 /* kernel define 'pgd_offset_k' redefinition */
index a687549..706a1ef 100644 (file)
@@ -102,7 +102,8 @@ int page_present (struct mm_struct *mm, unsigned long addr);
 extern unsigned long sched_addr;
 extern unsigned long fork_addr;
 extern unsigned long exit_addr;
-
+extern unsigned long sys_exit_group_addr;
+extern unsigned long do_group_exit_addr;
 
 DECLARE_MOD_DEP_WRAPPER (__flush_anon_page, \
                        void, struct vm_area_struct *vma, \