aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/siginfo.h
diff options
context:
space:
mode:
authorWill Drewry <wad@chromium.org>2012-04-12 17:48:00 -0400
committerJames Morris <james.l.morris@oracle.com>2012-04-13 21:13:21 -0400
commita0727e8ce513fe6890416da960181ceb10fbfae6 (patch)
tree300fc5c620c4e90915985504007d9e66bc896d14 /include/asm-generic/siginfo.h
parentacf3b2c71ed20c53dc69826683417703c2a88059 (diff)
signal, x86: add SIGSYS info and make it synchronous.
This change enables SIGSYS, defines _sigfields._sigsys, and adds x86 (compat) arch support. _sigsys defines fields which allow a signal handler to receive the triggering system call number, the relevant AUDIT_ARCH_* value for that number, and the address of the callsite. SIGSYS is added to the SYNCHRONOUS_MASK because it is desirable for it to have setup_frame() called for it. The goal is to ensure that ucontext_t reflects the machine state from the time-of-syscall and not from another signal handler. The first consumer of SIGSYS would be seccomp filter. In particular, a filter program could specify a new return value, SECCOMP_RET_TRAP, which would result in the system call being denied and the calling thread signaled. This also means that implementing arch-specific support can be dependent upon HAVE_ARCH_SECCOMP_FILTER. Suggested-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Will Drewry <wad@chromium.org> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Reviewed-by: H. Peter Anvin <hpa@zytor.com> Acked-by: Eric Paris <eparis@redhat.com> v18: - added acked by, rebase v17: - rebase and reviewed-by addition v14: - rebase/nochanges v13: - rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc v12: - reworded changelog (oleg@redhat.com) v11: - fix dropped words in the change description - added fallback copy_siginfo support. - added __ARCH_SIGSYS define to allow stepped arch support. v10: - first version based on suggestion Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'include/asm-generic/siginfo.h')
-rw-r--r--include/asm-generic/siginfo.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 0dd4e87f6fba..31306f55eb02 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -90,9 +90,18 @@ typedef struct siginfo {
90 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 90 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
91 int _fd; 91 int _fd;
92 } _sigpoll; 92 } _sigpoll;
93
94 /* SIGSYS */
95 struct {
96 void __user *_call_addr; /* calling insn */
97 int _syscall; /* triggering system call number */
98 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
99 } _sigsys;
93 } _sifields; 100 } _sifields;
94} siginfo_t; 101} siginfo_t;
95 102
103/* If the arch shares siginfo, then it has SIGSYS. */
104#define __ARCH_SIGSYS
96#endif 105#endif
97 106
98/* 107/*
@@ -116,6 +125,11 @@ typedef struct siginfo {
116#define si_addr_lsb _sifields._sigfault._addr_lsb 125#define si_addr_lsb _sifields._sigfault._addr_lsb
117#define si_band _sifields._sigpoll._band 126#define si_band _sifields._sigpoll._band
118#define si_fd _sifields._sigpoll._fd 127#define si_fd _sifields._sigpoll._fd
128#ifdef __ARCH_SIGSYS
129#define si_call_addr _sifields._sigsys._call_addr
130#define si_syscall _sifields._sigsys._syscall
131#define si_arch _sifields._sigsys._arch
132#endif
119 133
120#ifdef __KERNEL__ 134#ifdef __KERNEL__
121#define __SI_MASK 0xffff0000u 135#define __SI_MASK 0xffff0000u
@@ -126,6 +140,7 @@ typedef struct siginfo {
126#define __SI_CHLD (4 << 16) 140#define __SI_CHLD (4 << 16)
127#define __SI_RT (5 << 16) 141#define __SI_RT (5 << 16)
128#define __SI_MESGQ (6 << 16) 142#define __SI_MESGQ (6 << 16)
143#define __SI_SYS (7 << 16)
129#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 144#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
130#else 145#else
131#define __SI_KILL 0 146#define __SI_KILL 0
@@ -135,6 +150,7 @@ typedef struct siginfo {
135#define __SI_CHLD 0 150#define __SI_CHLD 0
136#define __SI_RT 0 151#define __SI_RT 0
137#define __SI_MESGQ 0 152#define __SI_MESGQ 0
153#define __SI_SYS 0
138#define __SI_CODE(T,N) (N) 154#define __SI_CODE(T,N) (N)
139#endif 155#endif
140 156
@@ -232,6 +248,12 @@ typedef struct siginfo {
232#define NSIGPOLL 6 248#define NSIGPOLL 6
233 249
234/* 250/*
251 * SIGSYS si_codes
252 */
253#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
254#define NSIGSYS 1
255
256/*
235 * sigevent definitions 257 * sigevent definitions
236 * 258 *
237 * It seems likely that SIGEV_THREAD will have to be handled from 259 * It seems likely that SIGEV_THREAD will have to be handled from