diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-20 17:00:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-20 18:09:43 -0500 |
commit | 8f7661496cece8320137d5e26808825498fd2b26 (patch) | |
tree | 7106ad6fb26f958b5c2e2ff87bec61e9245e336f /arch/x86/mm/fault.c | |
parent | f2f13a8535174dbb813a0607a9d4737cfba98f6c (diff) |
x86, mm: fault.c, unify oops printing
Impact: refine/extend page fault related oops printing on 64-bit
- honor the pause_on_oops logic on 64-bit too
- print out NX fault warnings on 64-bit as well
- factor out the NX fault message to make it git-greppable and readable
Note that this means that we do the PF_INSTR check on 32-bit non-PAE
as well where it should not occur ... normally. Cannot hurt.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/fault.c')
-rw-r--r-- | arch/x86/mm/fault.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 4ce62fb80da7..ebfaca3bbb12 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -595,28 +595,24 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address) | |||
595 | return 0; | 595 | return 0; |
596 | } | 596 | } |
597 | 597 | ||
598 | static const char nx_warning[] = KERN_CRIT | ||
599 | "kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n"; | ||
600 | |||
598 | static void | 601 | static void |
599 | show_fault_oops(struct pt_regs *regs, unsigned long error_code, | 602 | show_fault_oops(struct pt_regs *regs, unsigned long error_code, |
600 | unsigned long address) | 603 | unsigned long address) |
601 | { | 604 | { |
602 | #ifdef CONFIG_X86_32 | ||
603 | if (!oops_may_print()) | 605 | if (!oops_may_print()) |
604 | return; | 606 | return; |
605 | #endif | ||
606 | 607 | ||
607 | #ifdef CONFIG_X86_PAE | ||
608 | if (error_code & PF_INSTR) { | 608 | if (error_code & PF_INSTR) { |
609 | unsigned int level; | 609 | unsigned int level; |
610 | 610 | ||
611 | pte_t *pte = lookup_address(address, &level); | 611 | pte_t *pte = lookup_address(address, &level); |
612 | 612 | ||
613 | if (pte && pte_present(*pte) && !pte_exec(*pte)) { | 613 | if (pte && pte_present(*pte) && !pte_exec(*pte)) |
614 | printk(KERN_CRIT "kernel tried to execute " | 614 | printk(nx_warning, current_uid()); |
615 | "NX-protected page - exploit attempt? " | ||
616 | "(uid: %d)\n", current_uid()); | ||
617 | } | ||
618 | } | 615 | } |
619 | #endif | ||
620 | 616 | ||
621 | printk(KERN_ALERT "BUG: unable to handle kernel "); | 617 | printk(KERN_ALERT "BUG: unable to handle kernel "); |
622 | if (address < PAGE_SIZE) | 618 | if (address < PAGE_SIZE) |