Fix problem of KProbe insertion for DTV
authorEkaterina Gorelkina <ekaterina@ekaterina-desktop.(none)>
Thu, 16 Sep 2010 14:50:35 +0000 (18:50 +0400)
committerEkaterina Gorelkina <ekaterina@ekaterina-desktop.(none)>
Thu, 16 Sep 2010 14:50:35 +0000 (18:50 +0400)
driver/us_proc_inst.c
kprobe/arch/asm-arm/dbi_kprobes.c
kprobe/dbi_kprobes.h
kprobe/dbi_kprobes_deps.c
kprobe/dbi_kprobes_deps.h

index eed6b3d..ba367e9 100644 (file)
@@ -271,7 +271,7 @@ _restart:
                                                if (page_present (mm, addr))
                                                {
                                                        //DPRINTF ("pid %d, %s sym is present at %lx/%lx.", task->pid, us_proc_info.p_libs[i].path, us_proc_info.p_libs[i].p_ips[k].offset, addr);
-                                                       //if (!us_proc_info.p_libs[i].p_ips[k].installed)
+                                                       if (!us_proc_info.p_libs[i].p_ips[k].installed)
                                                        {
                                                                us_proc_info.unres_ips_count--;
                                                                us_proc_info.p_libs[i].p_ips[k].installed = 1;
index e6efbf0..e2e754b 100644 (file)
@@ -939,11 +939,12 @@ int trampoline_probe_handler (struct kprobe *p, struct pt_regs *regs)
        }
        kretprobe_assert (ri, orig_ret_address, trampoline_address);
        //BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address));
-       if (trampoline_address != (unsigned long) &kretprobe_trampoline){
-               if (ri->rp2) BUG_ON (ri->rp2->kp.tgid == 0);
-               if (ri->rp) BUG_ON (ri->rp->kp.tgid == 0);
-               else if (ri->rp2) BUG_ON (ri->rp2->kp.tgid == 0);
-       }
+       //E.G. Check this code in case of __switch_to function instrumentation -- currently this code generates dump in this case
+       //if (trampoline_address != (unsigned long) &kretprobe_trampoline){
+       //if (ri->rp2) BUG_ON (ri->rp2->kp.tgid == 0);
+       //if (ri->rp) BUG_ON (ri->rp->kp.tgid == 0);
+       //else if (ri->rp2) BUG_ON (ri->rp2->kp.tgid == 0);
+       //}
        if ((ri->rp && ri->rp->kp.tgid) || (ri->rp2 && ri->rp2->kp.tgid)) 
                BUG_ON (trampoline_address == (unsigned long) &kretprobe_trampoline);
 
index 44086c6..49911d9 100644 (file)
@@ -61,6 +61,7 @@
 #include <linux/spinlock.h>
 #include <linux/rcupdate.h>
 #include <linux/sched.h>
+#include <linux/pagemap.h>
 
 #include "arch/asm/dbi_kprobes.h"
 
index 0f3d720..b3d92e4 100644 (file)
@@ -51,7 +51,9 @@ DECLARE_MOD_FUNC_DEP(access_process_vm, int, struct task_struct * tsk, unsigned
 DECLARE_MOD_FUNC_DEP(find_extend_vma, struct vm_area_struct *, struct mm_struct * mm, unsigned long addr);
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)
 DECLARE_MOD_FUNC_DEP(handle_mm_fault, int, struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access);
+#endif
 #else
 DECLARE_MOD_FUNC_DEP(handle_mm_fault, int, struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags);
 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30) */
@@ -88,9 +90,11 @@ IMP_MOD_DEP_WRAPPER (access_process_vm, tsk, addr, buf, len, write)
 IMP_MOD_DEP_WRAPPER (find_extend_vma, mm, addr)
 
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)
        DECLARE_MOD_DEP_WRAPPER (handle_mm_fault, \
                        int, struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access)
 IMP_MOD_DEP_WRAPPER (handle_mm_fault, mm, vma, address, write_access)
+#endif
 #else
        DECLARE_MOD_DEP_WRAPPER (handle_mm_fault, \
                        int, struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags)
@@ -126,7 +130,12 @@ IMP_MOD_DEP_WRAPPER (flush_ptrace_access, vma, page, uaddr, kaddr, len, write)
 
 int init_module_dependencies()
 {
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)
        INIT_MOD_DEP_VAR(handle_mm_fault, handle_mm_fault);
+#endif
+#endif
+
        INIT_MOD_DEP_VAR(flush_ptrace_access, flush_ptrace_access);
        INIT_MOD_DEP_VAR(find_extend_vma, find_extend_vma);
        INIT_MOD_DEP_VAR(get_gate_vma, get_gate_vma);
index 38560d6..e0602cc 100644 (file)
@@ -31,6 +31,8 @@
 #include <linux/version.h>     // LINUX_VERSION_CODE, KERNEL_VERSION()
 #include <linux/hugetlb.h>
 #include <linux/mempolicy.h>
+#include <linux/highmem.h>
+#include <linux/pagemap.h>
 
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12))