]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mm/fault.c
[ARM] Convert asm/uaccess.h to linux/uaccess.h
[linux-2.6-omap-h63xx.git] / arch / arm / mm / fault.c
index 846cce48e2b7fa8e2a012bfab6e76e1431390155..fcdae537a28f09e894686d758652a894ca19c1c5 100644 (file)
 #include <linux/signal.h>
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/kprobes.h>
+#include <linux/uaccess.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
 
 #include "fault.h"
 
+
+#ifdef CONFIG_KPROBES
+static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
+{
+       int ret = 0;
+
+       if (!user_mode(regs)) {
+               /* kprobe_running() needs smp_processor_id() */
+               preempt_disable();
+               if (kprobe_running() && kprobe_fault_handler(regs, fsr))
+                       ret = 1;
+               preempt_enable();
+       }
+
+       return ret;
+}
+#else
+static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
+{
+       return 0;
+}
+#endif
+
 /*
  * This is useful to dump out the page tables associated with
  * 'addr' in mm 'mm'.
@@ -197,7 +221,7 @@ survive:
        return fault;
 
 out_of_memory:
-       if (!is_init(tsk))
+       if (!is_global_init(tsk))
                goto out;
 
        /*
@@ -215,13 +239,16 @@ out:
        return fault;
 }
 
-static int
+static int __kprobes
 do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 {
        struct task_struct *tsk;
        struct mm_struct *mm;
        int fault, sig, code;
 
+       if (notify_page_fault(regs, fsr))
+               return 0;
+
        tsk = current;
        mm  = tsk->mm;
 
@@ -266,7 +293,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
                 * the page fault gracefully.
                 */
                printk("VM: killing process %s\n", tsk->comm);
-               do_exit(SIGKILL);
+               do_group_exit(SIGKILL);
                return 0;
        }
        if (fault & VM_FAULT_SIGBUS) {
@@ -311,7 +338,7 @@ no_context:
  * interrupt or a critical region, and should only copy the information
  * from the master page table, nothing more.
  */
-static int
+static int __kprobes
 do_translation_fault(unsigned long addr, unsigned int fsr,
                     struct pt_regs *regs)
 {