提交 0630e45c 编写于 作者: P Paul Mundt

sh: Check oops_may_print() in unhandled fault.

Only print out pgd/pte data in the oops path if oops_may_print()
holds true. Follows the i386 implementation.
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 fc1d4c9c
...@@ -32,7 +32,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -32,7 +32,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
struct task_struct *tsk; struct task_struct *tsk;
struct mm_struct *mm; struct mm_struct *mm;
struct vm_area_struct * vma; struct vm_area_struct * vma;
unsigned long page;
int si_code; int si_code;
siginfo_t info; siginfo_t info;
...@@ -170,24 +169,38 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -170,24 +169,38 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
* terminate things with extreme prejudice. * terminate things with extreme prejudice.
* *
*/ */
if (address < PAGE_SIZE)
printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); bust_spinlocks(1);
else
printk(KERN_ALERT "Unable to handle kernel paging request"); if (oops_may_print()) {
printk(" at virtual address %08lx\n", address); __typeof__(pte_val(__pte(0))) page;
printk(KERN_ALERT "pc = %08lx\n", regs->pc);
page = (unsigned long)get_TTB(); if (address < PAGE_SIZE)
if (page) { printk(KERN_ALERT "Unable to handle kernel NULL "
page = ((unsigned long *) page)[address >> PGDIR_SHIFT]; "pointer dereference");
printk(KERN_ALERT "*pde = %08lx\n", page); else
if (page & _PAGE_PRESENT) { printk(KERN_ALERT "Unable to handle kernel paging "
page &= PAGE_MASK; "request");
address &= 0x003ff000; printk(" at virtual address %08lx\n", address);
page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT]; printk(KERN_ALERT "pc = %08lx\n", regs->pc);
printk(KERN_ALERT "*pte = %08lx\n", page); page = (unsigned long)get_TTB();
if (page) {
page = ((__typeof__(page) *) __va(page))[address >>
PGDIR_SHIFT];
printk(KERN_ALERT "*pde = %08lx\n", page);
if (page & _PAGE_PRESENT) {
page &= PAGE_MASK;
address &= 0x003ff000;
page = ((__typeof__(page) *)
__va(page))[address >>
PAGE_SHIFT];
printk(KERN_ALERT "*pte = %08lx\n", page);
}
} }
} }
die("Oops", regs, writeaccess); die("Oops", regs, writeaccess);
bust_spinlocks(0);
do_exit(SIGKILL); do_exit(SIGKILL);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册