diff options
author | Anton Blanchard <anton@samba.org> | 2014-09-24 10:59:57 +0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2014-10-02 11:15:13 +0400 |
commit | 3913fdd7a23d9d8480ce3a6ca9cdf78bf0dec5a0 (patch) | |
tree | 9edd93074c68ffbfff5ee8800bc44ff34938cc7c /arch/powerpc/mm/fault.c | |
parent | 63af52629adcd1313c7db252f085263012ecd9db (diff) | |
download | linux-3913fdd7a23d9d8480ce3a6ca9cdf78bf0dec5a0.tar.xz |
powerpc: Add VM_FAULT_HWPOISON handling to powerpc page fault handler
do_page_fault was missing knowledge of HWPOISON, and we would oops
if userspace tried to access a poisoned page:
kernel BUG at arch/powerpc/mm/fault.c:180!
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/fault.c')
-rw-r--r-- | arch/powerpc/mm/fault.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index abc8c816a326..588b6ccc0569 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -114,7 +114,8 @@ static int store_updates_sp(struct pt_regs *regs) #define MM_FAULT_CONTINUE -1 #define MM_FAULT_ERR(sig) (sig) -static int do_sigbus(struct pt_regs *regs, unsigned long address) +static int do_sigbus(struct pt_regs *regs, unsigned long address, + unsigned int fault) { siginfo_t info; @@ -128,6 +129,13 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address) info.si_errno = 0; info.si_code = BUS_ADRERR; info.si_addr = (void __user *)address; +#ifdef CONFIG_MEMORY_FAILURE + if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) { + pr_err("MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n", + current->comm, current->pid, address); + info.si_code = BUS_MCEERR_AR; + } +#endif force_sig_info(SIGBUS, &info, current); return MM_FAULT_RETURN; } @@ -170,11 +178,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault) return MM_FAULT_RETURN; } - /* Bus error. x86 handles HWPOISON here, we'll add this if/when - * we support the feature in HW - */ - if (fault & VM_FAULT_SIGBUS) - return do_sigbus(regs, addr); + if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) + return do_sigbus(regs, addr, fault); /* We don't understand the fault code, this is fatal */ BUG(); |