aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2014-11-14 10:18:19 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-11-17 18:58:53 -0500
commitee1b58d36aa1b5a79eaba11f5c3633c88231da83 (patch)
treec27ee172205f77faf191d3112b5a88d688c722c4
parent62e7759b1bdaf9b753c3724a56fcbe3235ebd5f3 (diff)
mpx: Extend siginfo structure to include bound violation information
This patch adds new fields about bound violation into siginfo structure. si_lower and si_upper are respectively lower bound and upper bound when bound violation is caused. Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: linux-mm@kvack.org Cc: linux-mips@linux-mips.org Cc: Dave Hansen <dave@sr71.net> Link: http://lkml.kernel.org/r/20141114151819.1908C900@viggo.jf.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/uapi/asm-generic/siginfo.h9
-rw-r--r--kernel/signal.c4
2 files changed, 12 insertions, 1 deletions
diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h
index ba5be7fdbdfe..1e3552037a5a 100644
--- a/include/uapi/asm-generic/siginfo.h
+++ b/include/uapi/asm-generic/siginfo.h
@@ -91,6 +91,10 @@ typedef struct siginfo {
91 int _trapno; /* TRAP # which caused the signal */ 91 int _trapno; /* TRAP # which caused the signal */
92#endif 92#endif
93 short _addr_lsb; /* LSB of the reported address */ 93 short _addr_lsb; /* LSB of the reported address */
94 struct {
95 void __user *_lower;
96 void __user *_upper;
97 } _addr_bnd;
94 } _sigfault; 98 } _sigfault;
95 99
96 /* SIGPOLL */ 100 /* SIGPOLL */
@@ -131,6 +135,8 @@ typedef struct siginfo {
131#define si_trapno _sifields._sigfault._trapno 135#define si_trapno _sifields._sigfault._trapno
132#endif 136#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb 137#define si_addr_lsb _sifields._sigfault._addr_lsb
138#define si_lower _sifields._sigfault._addr_bnd._lower
139#define si_upper _sifields._sigfault._addr_bnd._upper
134#define si_band _sifields._sigpoll._band 140#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd 141#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS 142#ifdef __ARCH_SIGSYS
@@ -199,7 +205,8 @@ typedef struct siginfo {
199 */ 205 */
200#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ 206#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
201#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ 207#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
202#define NSIGSEGV 2 208#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */
209#define NSIGSEGV 3
203 210
204/* 211/*
205 * SIGBUS si_codes 212 * SIGBUS si_codes
diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f9f6dd..2c403a4c8bee 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2748,6 +2748,10 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
2748 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 2748 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
2749 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 2749 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
2750#endif 2750#endif
2751#ifdef SEGV_BNDERR
2752 err |= __put_user(from->si_lower, &to->si_lower);
2753 err |= __put_user(from->si_upper, &to->si_upper);
2754#endif
2751 break; 2755 break;
2752 case __SI_CHLD: 2756 case __SI_CHLD:
2753 err |= __put_user(from->si_pid, &to->si_pid); 2757 err |= __put_user(from->si_pid, &to->si_pid);