prevent kprobes from catching spurious page faults

Prevent kprobes from catching spurious faults which will cause infinite
recursive page-fault and memory corruption by stack overflow.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: <stable@kernel.org> [2.6.28.x]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Masami Hiramatsu and committed by Linus Torvalds 9be260a6 767b5828

+6 -2
+6 -2
arch/x86/mm/fault.c
··· 603 603 604 604 si_code = SEGV_MAPERR; 605 605 606 - if (notify_page_fault(regs)) 607 - return; 608 606 if (unlikely(kmmio_fault(regs, address))) 609 607 return; 610 608 ··· 632 634 if (spurious_fault(address, error_code)) 633 635 return; 634 636 637 + /* kprobes don't want to hook the spurious faults. */ 638 + if (notify_page_fault(regs)) 639 + return; 635 640 /* 636 641 * Don't take the mm semaphore here. If we fixup a prefetch 637 642 * fault we could otherwise deadlock. ··· 642 641 goto bad_area_nosemaphore; 643 642 } 644 643 644 + /* kprobes don't want to hook the spurious faults. */ 645 + if (notify_page_fault(regs)) 646 + return; 645 647 646 648 /* 647 649 * It's safe to allow irq's after cr2 has been saved and the