]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/mm/fault.c
Merge branch 'fix/hda' into for-linus
[linux-2.6-omap-h63xx.git] / arch / x86 / mm / fault.c
index 57ec8c86a8776700729f682fc8a9b60b6a3482cd..c76ef1d701c9f48625aed06d4e7b4ec3d98e8862 100644 (file)
@@ -534,7 +534,7 @@ static int vmalloc_fault(unsigned long address)
           happen within a race in page table update. In the later
           case just flush. */
 
-       pgd = pgd_offset(current->mm ?: &init_mm, address);
+       pgd = pgd_offset(current->active_mm, address);
        pgd_ref = pgd_offset_k(address);
        if (pgd_none(*pgd_ref))
                return -1;
@@ -603,8 +603,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
 
        si_code = SEGV_MAPERR;
 
-       if (notify_page_fault(regs))
-               return;
        if (unlikely(kmmio_fault(regs, address)))
                return;
 
@@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                if (spurious_fault(address, error_code))
                        return;
 
+               /* kprobes don't want to hook the spurious faults. */
+               if (notify_page_fault(regs))
+                       return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
@@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                goto bad_area_nosemaphore;
        }
 
+       /* kprobes don't want to hook the spurious faults. */
+       if (notify_page_fault(regs))
+               return;
 
        /*
         * It's safe to allow irq's after cr2 has been saved and the
@@ -667,7 +671,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
        if (unlikely(in_atomic() || !mm))
                goto bad_area_nosemaphore;
 
-again:
        /*
         * When running in the kernel we expect faults to occur only to
         * addresses in user space.  All other faults represent errors in the
@@ -859,25 +862,14 @@ no_context:
        oops_end(flags, regs, sig);
 #endif
 
-/*
- * We ran out of memory, or some other thing happened to us that made
- * us unable to handle the page fault gracefully.
- */
 out_of_memory:
+       /*
+        * We ran out of memory, call the OOM killer, and return the userspace
+        * (which will retry the fault, or kill us if we got oom-killed).
+        */
        up_read(&mm->mmap_sem);
-       if (is_global_init(tsk)) {
-               yield();
-               /*
-                * Re-lookup the vma - in theory the vma tree might
-                * have changed:
-                */
-               goto again;
-       }
-
-       printk("VM: killing process %s\n", tsk->comm);
-       if (error_code & PF_USER)
-               do_group_exit(SIGKILL);
-       goto no_context;
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        up_read(&mm->mmap_sem);