public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [REVIEW][PATCH 1/9] signal/powerpc: Use force_sig_mceerr as appropriate
Date: Tue, 18 Sep 2018 19:58:42 +0200	[thread overview]
Message-ID: <20180918175850.4437-1-ebiederm@xmission.com> (raw)
In-Reply-To: <878t3yitze.fsf@xmission.com>

In do_sigbus isolate the mceerr signaling code and call
force_sig_mceerr instead of falling through to the force_sig_info that
works for all of the other signals.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
 arch/powerpc/mm/fault.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index d51cf5f4e45e..22d7f8748cd7 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -158,7 +158,6 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
 		     vm_fault_t fault)
 {
 	siginfo_t info;
-	unsigned int lsb = 0;
 
 	if (!user_mode(regs))
 		return SIGBUS;
@@ -171,17 +170,22 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
 	info.si_addr = (void __user *)address;
 #ifdef CONFIG_MEMORY_FAILURE
 	if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
+		unsigned int lsb = 0; /* shutup gcc */
+
 		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;
+
+		if (fault & VM_FAULT_HWPOISON_LARGE)
+			lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
+		if (fault & VM_FAULT_HWPOISON)
+			lsb = PAGE_SHIFT;
+
+		force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb,
+				 current);
+		return 0;
 	}
 
-	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 0;
 }
-- 
2.17.1

  parent reply	other threads:[~2018-09-18 17:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 17:41 [REVIEW][PATCH 0/9] signal/powerpc: siginfo cleanups Eric W. Biederman
2018-09-18 17:41 ` Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman [this message]
2018-09-18 17:58   ` [REVIEW][PATCH 1/9] signal/powerpc: Use force_sig_mceerr as appropriate Eric W. Biederman
2018-09-21  8:20   ` Stephen Rothwell
2018-09-21  8:20     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 2/9] signal/powerpc: Remove pkey parameter from __bad_area Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:23   ` Stephen Rothwell
2018-09-21  8:23     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 3/9] signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:27   ` Stephen Rothwell
2018-09-21  8:27     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 4/9] signal/powerpc: Remove pkey parameter from __bad_area_nosemaphore Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:32   ` Stephen Rothwell
2018-09-21  8:32     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 5/9] signal/powerpc: Factor the common exception code into exception_common Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:38   ` Stephen Rothwell
2018-09-21  8:38     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 6/9] signal/powerpc: Call force_sig_fault from _exception Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:48   ` Stephen Rothwell
2018-09-21  8:48     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 7/9] signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:54   ` Stephen Rothwell
2018-09-21  8:54     ` Stephen Rothwell
2018-09-21  8:58     ` Christophe LEROY
2018-09-21  8:58       ` Christophe LEROY
2018-09-18 17:58 ` [REVIEW][PATCH 8/9] signal/powerpc: Simplify _exception_pkey by using force_sig_pkuerr Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  8:57   ` Stephen Rothwell
2018-09-21  8:57     ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 9/9] signal/powerpc: Use force_sig_fault where appropriate Eric W. Biederman
2018-09-18 17:58   ` Eric W. Biederman
2018-09-21  9:05   ` Stephen Rothwell
2018-09-21  9:05     ` Stephen Rothwell
2018-09-21  9:06 ` [REVIEW][PATCH 0/9] signal/powerpc: siginfo cleanups Stephen Rothwell
2018-09-21  9:06   ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180918175850.4437-1-ebiederm@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox