linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Khalid Aziz <khalid.aziz@oracle.com>
Cc: davem@davemloft.net, dave.hansen@linux.intel.com,
	anthony.yznaga@oracle.com, rob.gardner@oracle.com,
	mingo@kernel.org, jane.chu@oracle.com, vegard.nossum@oracle.com,
	linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,
	Khalid Aziz <khalid@gonehiking.org>
Subject: Re: [PATCH v12 11/11] sparc64: Update signal delivery to use new helper functions
Date: Wed, 21 Feb 2018 14:59:11 -0600	[thread overview]
Message-ID: <87zi42dppc.fsf@xmission.com> (raw)
In-Reply-To: <15cfb4f72990919ff6fa16414eee7e4d1a5c7430.1519227112.git.khalid.aziz@oracle.com> (Khalid Aziz's message of "Wed, 21 Feb 2018 10:15:53 -0700")

Khalid Aziz <khalid.aziz@oracle.com> writes:

> Commit f8ec66014ffd ("signal: Add send_sig_fault and force_sig_fault")
> added new helper functions to streamline signal delivery. This patch
> updates signal delivery for new/updated handlers for ADI related
> exceptions to use the helper function.
>
> Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
> Cc: Khalid Aziz <khalid@gonehiking.org>

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

> ---
> v12:
> 	- new patch
>
>  arch/sparc/kernel/traps_64.c | 38 +++++++++-----------------------------
>  1 file changed, 9 insertions(+), 29 deletions(-)
>
> diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
> index f36a40217f6c..462a21abd105 100644
> --- a/arch/sparc/kernel/traps_64.c
> +++ b/arch/sparc/kernel/traps_64.c
> @@ -362,7 +362,6 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
>  {
>  	unsigned short type = (type_ctx >> 16);
>  	unsigned short ctx  = (type_ctx & 0xffff);
> -	siginfo_t info;
>  
>  	if (notify_die(DIE_TRAP, "data access exception", regs,
>  		       0, 0x8, SIGTRAP) == NOTIFY_STOP)
> @@ -406,24 +405,18 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
>  	 * kerbel by HV as data access exception with fault type set to
>  	 * HV_FAULT_TYPE_INV_ASI.
>  	 */
> -	info.si_errno = 0;
> -	info.si_addr = (void __user *) addr;
> -	info.si_trapno = 0;
>  	switch (type) {
>  	case HV_FAULT_TYPE_INV_ASI:
> -		info.si_signo = SIGILL;
> -		info.si_code = ILL_ILLADR;
> -		force_sig_info(SIGILL, &info, current);
> +		force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0,
> +				current);
>  		break;
>  	case HV_FAULT_TYPE_MCD_DIS:
> -		info.si_signo = SIGSEGV;
> -		info.si_code = SEGV_ACCADI;
> -		force_sig_info(SIGSEGV, &info, current);
> +		force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0,
> +				current);
>  		break;
>  	default:
> -		info.si_signo = SIGSEGV;
> -		info.si_code = SEGV_MAPERR;
> -		force_sig_info(SIGSEGV, &info, current);
> +		force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0,
> +				current);
>  		break;
>  	}
>  }
> @@ -2073,8 +2066,6 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
>   */
>  void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
>  {
> -	siginfo_t info;
> -
>  	if (notify_die(DIE_TRAP, "MCD error", regs, 0, 0x34,
>  		       SIGSEGV) == NOTIFY_STOP)
>  		return;
> @@ -2110,12 +2101,8 @@ void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
>  	/* Send SIGSEGV to the userspace process with the right signal
>  	 * code
>  	 */
> -	info.si_signo = SIGSEGV;
> -	info.si_errno = 0;
> -	info.si_code = SEGV_ADIDERR;
> -	info.si_addr = (void __user *)ent.err_raddr;
> -	info.si_trapno = 0;
> -	force_sig_info(SIGSEGV, &info, current);
> +	force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr,
> +			0, current);
>  }
>  
>  /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
> @@ -2748,8 +2735,6 @@ void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_c
>  void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs, unsigned long addr,
>  				      unsigned long context)
>  {
> -	siginfo_t info;
> -
>  	if (notify_die(DIE_TRAP, "memory corruption precise exception", regs,
>  		       0, 0x8, SIGSEGV) == NOTIFY_STOP)
>  		return;
> @@ -2784,12 +2769,7 @@ void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs, unsigned long addr,
>  		regs->tpc &= 0xffffffff;
>  		regs->tnpc &= 0xffffffff;
>  	}
> -	info.si_signo = SIGSEGV;
> -	info.si_code = SEGV_ADIPERR;
> -	info.si_errno = 0;
> -	info.si_addr = (void __user *) addr;
> -	info.si_trapno = 0;
> -	force_sig_info(SIGSEGV, &info, current);
> +	force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current);
>  }
>  
>  void do_privop(struct pt_regs *regs)

  reply	other threads:[~2018-02-21 21:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 17:15 [PATCH v12 00/11] Application Data Integrity feature introduced by SPARC M7 Khalid Aziz
2018-02-21 17:15 ` [PATCH v12 01/11] signals, sparc: Add signal codes for ADI violations Khalid Aziz
2018-02-21 20:58   ` Eric W. Biederman
2018-02-21 17:15 ` [PATCH v12 02/11] mm, swap: Add infrastructure for saving page metadata on swap Khalid Aziz
2018-03-05 19:20   ` Dave Hansen
2018-03-05 19:29     ` Khalid Aziz
2018-03-05 19:35       ` Dave Hansen
2018-03-05 20:28         ` Khalid Aziz
2018-03-05 21:04           ` Dave Hansen
2018-03-05 21:14             ` Khalid Aziz
2018-03-06 22:47   ` Andrew Morton
2018-02-21 17:15 ` [PATCH v12 03/11] sparc64: Add support for ADI register fields, ASIs and traps Khalid Aziz
2018-02-21 17:15 ` [PATCH v12 04/11] sparc64: Add HV fault type handlers for ADI related faults Khalid Aziz
2018-02-21 17:15 ` [PATCH v12 05/11] sparc64: Add handler for "Memory Corruption Detected" trap Khalid Aziz
2018-02-21 17:15 ` [PATCH v12 06/11] sparc64: Add auxiliary vectors to report platform ADI properties Khalid Aziz
2018-02-21 17:15 ` [PATCH v12 07/11] mm: Add address parameter to arch_validate_prot() Khalid Aziz
2018-02-26  5:54   ` Michael Ellerman
2018-03-06 22:48   ` Andrew Morton
2018-02-21 17:15 ` [PATCH v12 08/11] mm: Clear arch specific VM flags on protection change Khalid Aziz
2018-03-05 19:23   ` Dave Hansen
2018-03-05 20:38     ` Khalid Aziz
2018-03-06 22:48   ` Andrew Morton
2018-02-21 17:15 ` [PATCH v12 09/11] mm: Allow arch code to override copy_highpage() Khalid Aziz
2018-03-05 19:24   ` Dave Hansen
2018-03-05 20:42     ` Khalid Aziz
2018-03-05 20:56       ` Dave Hansen
2018-03-06 22:48   ` Andrew Morton
2018-02-21 17:15 ` [PATCH v12 10/11] sparc64: Add support for ADI (Application Data Integrity) Khalid Aziz
2018-02-23  2:50   ` kbuild test robot
2018-02-23 18:51     ` Khalid Aziz
2018-02-23 18:57       ` David Miller
2018-02-23 22:11         ` Khalid Aziz
2018-03-05 19:22   ` Dave Hansen
2018-03-05 21:14     ` Khalid Aziz
2018-03-05 21:26       ` Dave Hansen
2018-03-05 21:31       ` Dave Hansen
2018-03-05 22:55         ` Khalid Aziz
2018-03-05 21:26   ` Dave Hansen
2018-03-05 21:37     ` Khalid Aziz
2018-03-05 21:50       ` Dave Hansen
2018-02-21 17:15 ` [PATCH v12 11/11] sparc64: Update signal delivery to use new helper functions Khalid Aziz
2018-02-21 20:59   ` Eric W. Biederman [this message]
2018-03-18 15:08 ` [PATCH v12 00/11] Application Data Integrity feature introduced by SPARC M7 David Miller
2018-03-19 15:19   ` Khalid Aziz

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=87zi42dppc.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=anthony.yznaga@oracle.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=jane.chu@oracle.com \
    --cc=khalid.aziz@oracle.com \
    --cc=khalid@gonehiking.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rob.gardner@oracle.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=vegard.nossum@oracle.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).