From patchwork Wed Feb 21 17:15:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Aziz X-Patchwork-Id: 876217 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="NHaameWZ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zmkkQ5Kcrz9sW8 for ; Thu, 22 Feb 2018 04:19:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754839AbeBURT1 (ORCPT ); Wed, 21 Feb 2018 12:19:27 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36618 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754761AbeBURTZ (ORCPT ); Wed, 21 Feb 2018 12:19:25 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1LHJCYm099042; Wed, 21 Feb 2018 17:19:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2017-10-26; bh=9aMghINAbVRWPaxg8sHnyShLtvcb1JC/IdrkS/Eklx8=; b=NHaameWZF1qlAAhiYqRpKg7NPRlm5Ne1Ci/uZNJFgAeaaR9/y/wt+yhP4ciEuTPtcXyE sqUz0sagXsNfoLDkgIYfv4HGu1TtprROmC9d+CT4Dd3vcjioM34hlaedcp/WxFea06pY pix53tx7Js3pULDig5+h4D7rud3iXhj6+OE4HdzTh5ByTCsa/3EUmL4r1/mjCJcTqh3b BdpeUmWG1CIjYcpd+TYrXdFhFnyT3qu4zhYZLjoygkiA1iGhVP9chPudaPFhdpvXtbPv jXJIDux0M2HiCip8+1quam2QdPhiOBq6ICbEtc1tOOGwAgyObxNoOq+BpFhK5niTF9mi og== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2g9bwmgexh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Feb 2018 17:19:17 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1LHH4uN029325 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Feb 2018 17:17:04 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1LHH4Hw032753; Wed, 21 Feb 2018 17:17:04 GMT Received: from concerto.us.oracle.com (/24.9.64.241) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 21 Feb 2018 09:17:03 -0800 From: Khalid Aziz To: davem@davemloft.net, ebiederm@xmission.com, dave.hansen@linux.intel.com Cc: Khalid Aziz , 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 Subject: [PATCH v12 11/11] sparc64: Update signal delivery to use new helper functions Date: Wed, 21 Feb 2018 10:15:53 -0700 Message-Id: <15cfb4f72990919ff6fa16414eee7e4d1a5c7430.1519227112.git.khalid.aziz@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8811 signatures=668676 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802210211 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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 Cc: Khalid Aziz Acked-by: "Eric W. Biederman" --- 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)