aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/fault.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2014-09-24 02:59:58 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2014-10-02 03:15:17 -0400
commit9d57472f61acd7c3a33ebf5a79361e316d8ffbef (patch)
treedc1beb2245168ed89a1943536354de8eb179c61a /arch/powerpc/mm/fault.c
parent3913fdd7a23d9d8480ce3a6ca9cdf78bf0dec5a0 (diff)
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: 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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 588b6ccc0569..24b3f4949df4 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -33,6 +33,7 @@
33#include <linux/magic.h> 33#include <linux/magic.h>
34#include <linux/ratelimit.h> 34#include <linux/ratelimit.h>
35#include <linux/context_tracking.h> 35#include <linux/context_tracking.h>
36#include <linux/hugetlb.h>
36 37
37#include <asm/firmware.h> 38#include <asm/firmware.h>
38#include <asm/page.h> 39#include <asm/page.h>
@@ -118,6 +119,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
118 unsigned int fault) 119 unsigned int fault)
119{ 120{
120 siginfo_t info; 121 siginfo_t info;
122 unsigned int lsb = 0;
121 123
122 up_read(&current->mm->mmap_sem); 124 up_read(&current->mm->mmap_sem);
123 125
@@ -135,7 +137,13 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
135 current->comm, current->pid, address); 137 current->comm, current->pid, address);
136 info.si_code = BUS_MCEERR_AR; 138 info.si_code = BUS_MCEERR_AR;
137 } 139 }
140
141 if (fault & VM_FAULT_HWPOISON_LARGE)
142 lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
143 if (fault & VM_FAULT_HWPOISON)
144 lsb = PAGE_SHIFT;
138#endif 145#endif
146 info.si_addr_lsb = lsb;
139 force_sig_info(SIGBUS, &info, current); 147 force_sig_info(SIGBUS, &info, current);
140 return MM_FAULT_RETURN; 148 return MM_FAULT_RETURN;
141} 149}