linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [REVIEW][PATCH 06/15] signal/arm64: For clarity separate the 3 signal sending cases in do_page_fault
Date: Mon, 24 Sep 2018 11:10:06 +0200	[thread overview]
Message-ID: <20180924091015.4458-6-ebiederm@xmission.com> (raw)
In-Reply-To: <871s9j462u.fsf@xmission.com>

It gets easy to confuse what is going on when some code is shared and some not
so stop sharing the trivial bits of signal generation to make future updates
easier to understand.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
 arch/arm64/mm/fault.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 0ddc8c6ba53b..14d6ff895139 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -567,16 +567,16 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
 		return 0;
 	}
 
-	clear_siginfo(&si);
-	si.si_addr = (void __user *)addr;
-
 	if (fault & VM_FAULT_SIGBUS) {
 		/*
 		 * We had some memory, but were unable to successfully fix up
 		 * this page fault.
 		 */
+		clear_siginfo(&si);
 		si.si_signo	= SIGBUS;
 		si.si_code	= BUS_ADRERR;
+		si.si_addr = (void __user *)addr;
+		__do_user_fault(&si, esr);
 	} else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) {
 		unsigned int lsb;
 
@@ -584,20 +584,25 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
 		if (fault & VM_FAULT_HWPOISON_LARGE)
 			lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
 
+		clear_siginfo(&si);
 		si.si_signo	= SIGBUS;
 		si.si_code	= BUS_MCEERR_AR;
+		si.si_addr = (void __user *)addr;
 		si.si_addr_lsb	= lsb;
+		__do_user_fault(&si, esr);
 	} else {
 		/*
 		 * Something tried to access memory that isn't in our memory
 		 * map.
 		 */
+		clear_siginfo(&si);
 		si.si_signo	= SIGSEGV;
 		si.si_code	= fault == VM_FAULT_BADACCESS ?
 				  SEGV_ACCERR : SEGV_MAPERR;
+		si.si_addr = (void __user *)addr;
+		__do_user_fault(&si, esr);
 	}
 
-	__do_user_fault(&si, esr);
 	return 0;
 
 no_context:
-- 
2.17.1


  parent reply	other threads:[~2018-09-24  9:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24  9:07 [REVIEW][PATCH 00/15] signal/arm64: siginfo cleanups Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 01/15] signal/arm64: Push siginfo generation into arm64_notify_die Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 02/15] signal/arm64: Remove unneeded tsk parameter from arm64_force_sig_info Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 03/15] signal/arm64: Factor out arm64_show_signal " Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 04/15] signal/arm64: Factor set_thread_esr out of __do_user_fault Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 05/15] signal/arm64: Consolidate the two hwpoison cases in do_page_fault Eric W. Biederman
2018-09-24  9:10 ` Eric W. Biederman [this message]
2018-09-24  9:10 ` [REVIEW][PATCH 07/15] signal/arm64: Expand __do_user_fault and remove it Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 08/15] signal/arm64: Only perform one esr_to_fault_info call in do_page_fault Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 09/15] signal/arm64: Only call set_thread_esr once " Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 10/15] signal/arm64: Add and use arm64_force_sig_fault where appropriate Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 11/15] signal/arm64: Add and use arm64_force_sig_mceerr as appropriate Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 12/15] signal/arm64: Remove arm64_force_sig_info Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 13/15] signal/arm64: In ptrace_hbptriggered name the signal description string Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 14/15] signal/arm64: Add and use arm64_force_sig_ptrace_errno_trap Eric W. Biederman
2018-09-24  9:10 ` [REVIEW][PATCH 15/15] signal/arm64: Use send_sig_fault where appropriate Eric W. Biederman
2018-09-26 17:38 ` [REVIEW][PATCH 00/15] signal/arm64: siginfo cleanups Catalin Marinas
2018-09-27  9:39   ` Eric W. Biederman
2018-09-27 13:50     ` Catalin Marinas

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=20180924091015.4458-6-ebiederm@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).