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