From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938602AbdAKQOo (ORCPT ); Wed, 11 Jan 2017 11:14:44 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:40953 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765009AbdAKQOc (ORCPT ); Wed, 11 Jan 2017 11:14:32 -0500 From: Khalid Aziz To: arnd@arndb.de, davem@davemloft.net Cc: Khalid Aziz , hpa@zytor.com, 0x7f454c46@gmail.com, dave.hansen@linux.intel.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, sparclinux@vger.kernel.org, Khalid Aziz Subject: [PATCH v4 1/4] signals, sparc: Add signal codes for ADI violations Date: Wed, 11 Jan 2017 09:12:51 -0700 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SPARC M7 processor introduces a new feature - Application Data Integrity (ADI). ADI allows MMU to catch rogue accesses to memory. When a rogue access occurs, MMU blocks the access and raises an exception. In response to the exception, kernel sends the offending task a SIGSEGV with si_code that indicates the nature of exception. This patch adds three new signal codes specific to ADI feature: 1. ADI is not enabled for the address and task attempted to access memory using ADI 2. Task attempted to access memory using wrong ADI tag and caused a deferred exception. 3. Task attempted to access memory using wrong ADI Ttag and caused a precise exception. Signed-off-by: Khalid Aziz Cc: Khalid Aziz --- arch/x86/kernel/signal_compat.c | 2 +- include/uapi/asm-generic/siginfo.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/signal_compat.c b/arch/x86/kernel/signal_compat.c index ec1f756..d1e860c 100644 --- a/arch/x86/kernel/signal_compat.c +++ b/arch/x86/kernel/signal_compat.c @@ -26,7 +26,7 @@ static inline void signal_compat_build_tests(void) */ BUILD_BUG_ON(NSIGILL != 8); BUILD_BUG_ON(NSIGFPE != 8); - BUILD_BUG_ON(NSIGSEGV != 4); + BUILD_BUG_ON(NSIGSEGV != 7); BUILD_BUG_ON(NSIGBUS != 5); BUILD_BUG_ON(NSIGTRAP != 4); BUILD_BUG_ON(NSIGCHLD != 6); diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h index 1abaf62..2446864 100644 --- a/include/uapi/asm-generic/siginfo.h +++ b/include/uapi/asm-generic/siginfo.h @@ -213,7 +213,10 @@ typedef struct siginfo { #define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ #define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */ #define SEGV_PKUERR (__SI_FAULT|4) /* failed protection key checks */ -#define NSIGSEGV 4 +#define SEGV_ACCADI (__SI_FAULT|5) /* ADI not enabled for mapped object */ +#define SEGV_ADIDERR (__SI_FAULT|6) /* Disrupting MCD error */ +#define SEGV_ADIPERR (__SI_FAULT|7) /* Precise MCD exception */ +#define NSIGSEGV 7 /* * SIGBUS si_codes -- 2.7.4