Merge master.kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6
[sfrench/cifs-2.6.git] / arch / x86_64 / mm / fault.c
index 13792721037e1692670732b49d7c92b6d39b68fa..b75b872ec154f8e004fc04a29375eb97f7f468bb 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/vt_kern.h>             /* For unblank_screen() */
 #include <linux/compiler.h>
 #include <linux/module.h>
+#include <linux/kprobes.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -211,9 +212,7 @@ int unhandled_signal(struct task_struct *tsk, int sig)
 {
        if (tsk->pid == 1)
                return 1;
-       /* Warn for strace, but not for gdb */
-       if (!test_ti_thread_flag(tsk->thread_info, TIF_SYSCALL_TRACE) &&
-           (tsk->ptrace & PT_PTRACED))
+       if (tsk->ptrace & PT_PTRACED)
                return 0;
        return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) ||
                (tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
@@ -222,12 +221,13 @@ int unhandled_signal(struct task_struct *tsk, int sig)
 static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
                                 unsigned long error_code)
 {
-       oops_begin();
+       unsigned long flags = oops_begin();
+
        printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
               current->comm, address);
        dump_pagetable(address);
        __die("Bad pagetable", regs, error_code);
-       oops_end();
+       oops_end(flags);
        do_exit(SIGKILL);
 }
 
@@ -296,7 +296,8 @@ int exception_trace = 1;
  *     bit 2 == 0 means kernel, 1 means user-mode
  *      bit 3 == 1 means fault was an instruction fetch
  */
-asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
+asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
+                                       unsigned long error_code)
 {
        struct task_struct *tsk;
        struct mm_struct *mm;
@@ -304,6 +305,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
        unsigned long address;
        const struct exception_table_entry *fixup;
        int write;
+       unsigned long flags;
        siginfo_t info;
 
 #ifdef CONFIG_CHECKING
@@ -439,13 +441,13 @@ good_area:
         * the fault.
         */
        switch (handle_mm_fault(mm, vma, address, write)) {
-       case 1:
+       case VM_FAULT_MINOR:
                tsk->min_flt++;
                break;
-       case 2:
+       case VM_FAULT_MAJOR:
                tsk->maj_flt++;
                break;
-       case 0:
+       case VM_FAULT_SIGBUS:
                goto do_sigbus;
        default:
                goto out_of_memory;
@@ -521,7 +523,7 @@ no_context:
  * terminate things with extreme prejudice.
  */
 
-       oops_begin(); 
+       flags = oops_begin();
 
        if (address < PAGE_SIZE)
                printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
@@ -534,7 +536,7 @@ no_context:
        __die("Oops", regs, error_code);
        /* Executive summary in case the body of the oops scrolled away */
        printk(KERN_EMERG "CR2: %016lx\n", address);
-       oops_end(); 
+       oops_end(flags);
        do_exit(SIGKILL);
 
 /*