diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-20 16:18:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-20 18:09:41 -0500 |
commit | 121d5d0a7e5808fbcfda484efd7ba840ac93450f (patch) | |
tree | 666785943c648f8119b8533c9b640dbc37fb23b4 /arch/x86/mm | |
parent | 8c938f9fae887f6e180bf802aa1c33cf74712aff (diff) |
x86, mm: fault.c, enable PF_RSVD checks on 32-bit too
Impact: improve page fault handling robustness
The 'PF_RSVD' flag (bit 3) of the page-fault error_code is a
relatively recent addition to x86 CPUs, so the 32-bit do_fault()
implementation never had it. This flag gets set when the CPU
detects nonzero values in any reserved bits of the page directory
entries.
Extend the existing 64-bit check for PF_RSVD in do_page_fault()
to 32-bit too. If we detect such a fault then we print a more
informative oops and the pagetables.
This unifies the code some more, removes an ugly #ifdef and improves
the 32-bit page fault code robustness a bit. It slightly increases
the 32-bit kernel text size.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/fault.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 7dc0615c3cfe..3e3661462739 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -477,7 +477,6 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, | |||
477 | dump_pagetable(address); | 477 | dump_pagetable(address); |
478 | } | 478 | } |
479 | 479 | ||
480 | #ifdef CONFIG_X86_64 | ||
481 | static noinline void | 480 | static noinline void |
482 | pgtable_bad(struct pt_regs *regs, unsigned long error_code, | 481 | pgtable_bad(struct pt_regs *regs, unsigned long error_code, |
483 | unsigned long address) | 482 | unsigned long address) |
@@ -503,7 +502,6 @@ pgtable_bad(struct pt_regs *regs, unsigned long error_code, | |||
503 | 502 | ||
504 | oops_end(flags, regs, sig); | 503 | oops_end(flags, regs, sig); |
505 | } | 504 | } |
506 | #endif | ||
507 | 505 | ||
508 | static noinline void | 506 | static noinline void |
509 | no_context(struct pt_regs *regs, unsigned long error_code, | 507 | no_context(struct pt_regs *regs, unsigned long error_code, |
@@ -1015,10 +1013,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
1015 | local_irq_enable(); | 1013 | local_irq_enable(); |
1016 | } | 1014 | } |
1017 | 1015 | ||
1018 | #ifdef CONFIG_X86_64 | ||
1019 | if (unlikely(error_code & PF_RSVD)) | 1016 | if (unlikely(error_code & PF_RSVD)) |
1020 | pgtable_bad(regs, error_code, address); | 1017 | pgtable_bad(regs, error_code, address); |
1021 | #endif | ||
1022 | 1018 | ||
1023 | /* | 1019 | /* |
1024 | * If we're in an interrupt, have no user context or are running | 1020 | * If we're in an interrupt, have no user context or are running |