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>
This commit is contained in:
@@ -595,28 +595,24 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char nx_warning[] = KERN_CRIT
|
||||||
|
"kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_fault_oops(struct pt_regs *regs, unsigned long error_code,
|
show_fault_oops(struct pt_regs *regs, unsigned long error_code,
|
||||||
unsigned long address)
|
unsigned long address)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_X86_32
|
|
||||||
if (!oops_may_print())
|
if (!oops_may_print())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_X86_PAE
|
|
||||||
if (error_code & PF_INSTR) {
|
if (error_code & PF_INSTR) {
|
||||||
unsigned int level;
|
unsigned int level;
|
||||||
|
|
||||||
pte_t *pte = lookup_address(address, &level);
|
pte_t *pte = lookup_address(address, &level);
|
||||||
|
|
||||||
if (pte && pte_present(*pte) && !pte_exec(*pte)) {
|
if (pte && pte_present(*pte) && !pte_exec(*pte))
|
||||||
printk(KERN_CRIT "kernel tried to execute "
|
printk(nx_warning, current_uid());
|
||||||
"NX-protected page - exploit attempt? "
|
|
||||||
"(uid: %d)\n", current_uid());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
printk(KERN_ALERT "BUG: unable to handle kernel ");
|
printk(KERN_ALERT "BUG: unable to handle kernel ");
|
||||||
if (address < PAGE_SIZE)
|
if (address < PAGE_SIZE)
|
||||||
|
Reference in New Issue
Block a user