Commit 46ddcb39 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/mm: Show if a bad page fault on data is read or write.

DSISR (or ESR on some CPUs) has a bit to tell if the fault is due to a
read or a write.

Display it.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: default avatarSantosh Sivaraj <santosh@fossix.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4f88d7e6fda53b5f80a71040ab400242f6c8cb93.1566400889.git.christophe.leroy@c-s.fr
parent c4028fa2
...@@ -645,6 +645,7 @@ NOKPROBE_SYMBOL(do_page_fault); ...@@ -645,6 +645,7 @@ NOKPROBE_SYMBOL(do_page_fault);
void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
{ {
const struct exception_table_entry *entry; const struct exception_table_entry *entry;
int is_write = page_fault_is_write(regs->dsisr);
/* Are we prepared to handle this fault? */ /* Are we prepared to handle this fault? */
if ((entry = search_exception_tables(regs->nip)) != NULL) { if ((entry = search_exception_tables(regs->nip)) != NULL) {
...@@ -658,9 +659,10 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) ...@@ -658,9 +659,10 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
case 0x300: case 0x300:
case 0x380: case 0x380:
case 0xe00: case 0xe00:
pr_alert("BUG: %s at 0x%08lx\n", pr_alert("BUG: %s on %s at 0x%08lx\n",
regs->dar < PAGE_SIZE ? "Kernel NULL pointer dereference" : regs->dar < PAGE_SIZE ? "Kernel NULL pointer dereference" :
"Unable to handle kernel data access", regs->dar); "Unable to handle kernel data access",
is_write ? "write" : "read", regs->dar);
break; break;
case 0x400: case 0x400:
case 0x480: case 0x480:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment