Commit 9d57472f authored by Anton Blanchard's avatar Anton Blanchard Committed by Michael Ellerman

powerpc: Fill in si_addr_lsb siginfo field

Fill in the si_addr_lsb siginfo field so the hwpoison code can
pass to userspace the length of memory that has been corrupted.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 3913fdd7
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/magic.h> #include <linux/magic.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/context_tracking.h> #include <linux/context_tracking.h>
#include <linux/hugetlb.h>
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/page.h> #include <asm/page.h>
...@@ -118,6 +119,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, ...@@ -118,6 +119,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
unsigned int fault) unsigned int fault)
{ {
siginfo_t info; siginfo_t info;
unsigned int lsb = 0;
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
...@@ -135,7 +137,13 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, ...@@ -135,7 +137,13 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
current->comm, current->pid, address); current->comm, current->pid, address);
info.si_code = BUS_MCEERR_AR; info.si_code = BUS_MCEERR_AR;
} }
if (fault & VM_FAULT_HWPOISON_LARGE)
lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
if (fault & VM_FAULT_HWPOISON)
lsb = PAGE_SHIFT;
#endif #endif
info.si_addr_lsb = lsb;
force_sig_info(SIGBUS, &info, current); force_sig_info(SIGBUS, &info, current);
return MM_FAULT_RETURN; return MM_FAULT_RETURN;
} }
......
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