Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Anton Blanchard and committed by
Michael Ellerman
9d57472f 3913fdd7

+8
+8
arch/powerpc/mm/fault.c
··· 33 33 #include <linux/magic.h> 34 34 #include <linux/ratelimit.h> 35 35 #include <linux/context_tracking.h> 36 + #include <linux/hugetlb.h> 36 37 37 38 #include <asm/firmware.h> 38 39 #include <asm/page.h> ··· 119 118 unsigned int fault) 120 119 { 121 120 siginfo_t info; 121 + unsigned int lsb = 0; 122 122 123 123 up_read(&current->mm->mmap_sem); 124 124 ··· 137 135 current->comm, current->pid, address); 138 136 info.si_code = BUS_MCEERR_AR; 139 137 } 138 + 139 + if (fault & VM_FAULT_HWPOISON_LARGE) 140 + lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault)); 141 + if (fault & VM_FAULT_HWPOISON) 142 + lsb = PAGE_SHIFT; 140 143 #endif 144 + info.si_addr_lsb = lsb; 141 145 force_sig_info(SIGBUS, &info, current); 142 146 return MM_FAULT_RETURN; 143 147 }