From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id C3DD81A0465 for ; Wed, 24 Sep 2014 10:27:10 +1000 (EST) From: Anton Blanchard To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Subject: [PATCH 2/2] powerpc: Fill in si_addr_lsb siginfo field Date: Wed, 24 Sep 2014 10:27:07 +1000 Message-Id: <1411518427-14408-2-git-send-email-anton@samba.org> In-Reply-To: <1411518427-14408-1-git-send-email-anton@samba.org> References: <1411518427-14408-1-git-send-email-anton@samba.org> Cc: linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- arch/powerpc/mm/fault.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c3728c1..3b16c58 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, unsigned int fault) { siginfo_t info; + unsigned int lsb = 0; up_read(¤t->mm->mmap_sem); @@ -136,7 +138,13 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, current->comm, current->pid, address); 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 + info.si_addr_lsb = lsb; force_sig_info(SIGBUS, &info, current); return MM_FAULT_RETURN; } -- 1.9.1