16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28a1ab315SDavid Howells #ifndef _UAPI_ASM_GENERIC_SIGINFO_H 38a1ab315SDavid Howells #define _UAPI_ASM_GENERIC_SIGINFO_H 48a1ab315SDavid Howells 58a1ab315SDavid Howells #include <linux/compiler.h> 68a1ab315SDavid Howells #include <linux/types.h> 78a1ab315SDavid Howells 88a1ab315SDavid Howells typedef union sigval { 98a1ab315SDavid Howells int sival_int; 108a1ab315SDavid Howells void __user *sival_ptr; 118a1ab315SDavid Howells } sigval_t; 128a1ab315SDavid Howells 138a1ab315SDavid Howells #define SI_MAX_SIZE 128 148a1ab315SDavid Howells 158a1ab315SDavid Howells /* 168a1ab315SDavid Howells * The default "si_band" type is "long", as specified by POSIX. 178a1ab315SDavid Howells * However, some architectures want to override this to "int" 188a1ab315SDavid Howells * for historical compatibility reasons, so we allow that. 198a1ab315SDavid Howells */ 208a1ab315SDavid Howells #ifndef __ARCH_SI_BAND_T 218a1ab315SDavid Howells #define __ARCH_SI_BAND_T long 228a1ab315SDavid Howells #endif 238a1ab315SDavid Howells 248a1ab315SDavid Howells #ifndef __ARCH_SI_CLOCK_T 258a1ab315SDavid Howells #define __ARCH_SI_CLOCK_T __kernel_clock_t 268a1ab315SDavid Howells #endif 278a1ab315SDavid Howells 288a1ab315SDavid Howells #ifndef __ARCH_SI_ATTRIBUTES 298a1ab315SDavid Howells #define __ARCH_SI_ATTRIBUTES 308a1ab315SDavid Howells #endif 318a1ab315SDavid Howells 32f2838018SEric W. Biederman union __sifields { 338a1ab315SDavid Howells /* kill() */ 348a1ab315SDavid Howells struct { 358a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 364795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 378a1ab315SDavid Howells } _kill; 388a1ab315SDavid Howells 398a1ab315SDavid Howells /* POSIX.1b timers */ 408a1ab315SDavid Howells struct { 418a1ab315SDavid Howells __kernel_timer_t _tid; /* timer id */ 428a1ab315SDavid Howells int _overrun; /* overrun count */ 438a1ab315SDavid Howells sigval_t _sigval; /* same as below */ 448a1ab315SDavid Howells int _sys_private; /* not to be passed to user */ 458a1ab315SDavid Howells } _timer; 468a1ab315SDavid Howells 478a1ab315SDavid Howells /* POSIX.1b signals */ 488a1ab315SDavid Howells struct { 498a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 504795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 518a1ab315SDavid Howells sigval_t _sigval; 528a1ab315SDavid Howells } _rt; 538a1ab315SDavid Howells 548a1ab315SDavid Howells /* SIGCHLD */ 558a1ab315SDavid Howells struct { 568a1ab315SDavid Howells __kernel_pid_t _pid; /* which child */ 574795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 588a1ab315SDavid Howells int _status; /* exit code */ 598a1ab315SDavid Howells __ARCH_SI_CLOCK_T _utime; 608a1ab315SDavid Howells __ARCH_SI_CLOCK_T _stime; 618a1ab315SDavid Howells } _sigchld; 628a1ab315SDavid Howells 63deaf19c0SEric W. Biederman /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */ 648a1ab315SDavid Howells struct { 658a1ab315SDavid Howells void __user *_addr; /* faulting insn/memory ref. */ 668a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 678a1ab315SDavid Howells int _trapno; /* TRAP # which caused the signal */ 688a1ab315SDavid Howells #endif 692eb50e2eSEric W. Biederman #ifdef __ia64__ 702eb50e2eSEric W. Biederman int _imm; /* immediate value for "break" */ 712eb50e2eSEric W. Biederman unsigned int _flags; /* see ia64 si_flags */ 722eb50e2eSEric W. Biederman unsigned long _isr; /* isr */ 732eb50e2eSEric W. Biederman #endif 748420f719SEric W. Biederman 758420f719SEric W. Biederman #define __ADDR_BND_PKEY_PAD (__alignof__(void *) < sizeof(short) ? \ 768420f719SEric W. Biederman sizeof(short) : __alignof__(void *)) 77cd0ea35fSDave Hansen union { 78b68a68d3SEric W. Biederman /* 79b68a68d3SEric W. Biederman * used when si_code=BUS_MCEERR_AR or 80b68a68d3SEric W. Biederman * used when si_code=BUS_MCEERR_AO 81b68a68d3SEric W. Biederman */ 82b68a68d3SEric W. Biederman short _addr_lsb; /* LSB of the reported address */ 83cd0ea35fSDave Hansen /* used when si_code=SEGV_BNDERR */ 84ee1b58d3SQiaowei Ren struct { 858420f719SEric W. Biederman char _dummy_bnd[__ADDR_BND_PKEY_PAD]; 86ee1b58d3SQiaowei Ren void __user *_lower; 87ee1b58d3SQiaowei Ren void __user *_upper; 88ee1b58d3SQiaowei Ren } _addr_bnd; 89cd0ea35fSDave Hansen /* used when si_code=SEGV_PKUERR */ 90b68a68d3SEric W. Biederman struct { 918420f719SEric W. Biederman char _dummy_pkey[__ADDR_BND_PKEY_PAD]; 9249cd53bfSDave Hansen __u32 _pkey; 93b68a68d3SEric W. Biederman } _addr_pkey; 94cd0ea35fSDave Hansen }; 958a1ab315SDavid Howells } _sigfault; 968a1ab315SDavid Howells 978a1ab315SDavid Howells /* SIGPOLL */ 988a1ab315SDavid Howells struct { 998a1ab315SDavid Howells __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 1008a1ab315SDavid Howells int _fd; 1018a1ab315SDavid Howells } _sigpoll; 1028a1ab315SDavid Howells 1038a1ab315SDavid Howells /* SIGSYS */ 1048a1ab315SDavid Howells struct { 1058a1ab315SDavid Howells void __user *_call_addr; /* calling user insn */ 1068a1ab315SDavid Howells int _syscall; /* triggering system call number */ 1078a1ab315SDavid Howells unsigned int _arch; /* AUDIT_ARCH_* of syscall */ 1088a1ab315SDavid Howells } _sigsys; 109f2838018SEric W. Biederman }; 110f2838018SEric W. Biederman 111f2838018SEric W. Biederman #ifndef __ARCH_HAS_SWAPPED_SIGINFO 112f2838018SEric W. Biederman #define __SIGINFO \ 113f2838018SEric W. Biederman struct { \ 114f2838018SEric W. Biederman int si_signo; \ 115f2838018SEric W. Biederman int si_errno; \ 116f2838018SEric W. Biederman int si_code; \ 117f2838018SEric W. Biederman union __sifields _sifields; \ 118f2838018SEric W. Biederman } 119f2838018SEric W. Biederman #else 120f2838018SEric W. Biederman #define __SIGINFO \ 121f2838018SEric W. Biederman struct { \ 122f2838018SEric W. Biederman int si_signo; \ 123f2838018SEric W. Biederman int si_code; \ 124f2838018SEric W. Biederman int si_errno; \ 125f2838018SEric W. Biederman union __sifields _sifields; \ 126f2838018SEric W. Biederman } 127f2838018SEric W. Biederman #endif /* __ARCH_HAS_SWAPPED_SIGINFO */ 128f2838018SEric W. Biederman 129f2838018SEric W. Biederman typedef struct siginfo { 130f2838018SEric W. Biederman union { 131f2838018SEric W. Biederman __SIGINFO; 132f2838018SEric W. Biederman int _si_pad[SI_MAX_SIZE/sizeof(int)]; 133f2838018SEric W. Biederman }; 1348a1ab315SDavid Howells } __ARCH_SI_ATTRIBUTES siginfo_t; 1358a1ab315SDavid Howells 1368a1ab315SDavid Howells /* 1378a1ab315SDavid Howells * How these fields are to be accessed. 1388a1ab315SDavid Howells */ 1398a1ab315SDavid Howells #define si_pid _sifields._kill._pid 1408a1ab315SDavid Howells #define si_uid _sifields._kill._uid 1418a1ab315SDavid Howells #define si_tid _sifields._timer._tid 1428a1ab315SDavid Howells #define si_overrun _sifields._timer._overrun 1438a1ab315SDavid Howells #define si_sys_private _sifields._timer._sys_private 1448a1ab315SDavid Howells #define si_status _sifields._sigchld._status 1458a1ab315SDavid Howells #define si_utime _sifields._sigchld._utime 1468a1ab315SDavid Howells #define si_stime _sifields._sigchld._stime 1478a1ab315SDavid Howells #define si_value _sifields._rt._sigval 1488a1ab315SDavid Howells #define si_int _sifields._rt._sigval.sival_int 1498a1ab315SDavid Howells #define si_ptr _sifields._rt._sigval.sival_ptr 1508a1ab315SDavid Howells #define si_addr _sifields._sigfault._addr 1518a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 1528a1ab315SDavid Howells #define si_trapno _sifields._sigfault._trapno 1538a1ab315SDavid Howells #endif 1548a1ab315SDavid Howells #define si_addr_lsb _sifields._sigfault._addr_lsb 155ee1b58d3SQiaowei Ren #define si_lower _sifields._sigfault._addr_bnd._lower 156ee1b58d3SQiaowei Ren #define si_upper _sifields._sigfault._addr_bnd._upper 157b68a68d3SEric W. Biederman #define si_pkey _sifields._sigfault._addr_pkey._pkey 1588a1ab315SDavid Howells #define si_band _sifields._sigpoll._band 1598a1ab315SDavid Howells #define si_fd _sifields._sigpoll._fd 1608a1ab315SDavid Howells #define si_call_addr _sifields._sigsys._call_addr 1618a1ab315SDavid Howells #define si_syscall _sifields._sigsys._syscall 1628a1ab315SDavid Howells #define si_arch _sifields._sigsys._arch 1638a1ab315SDavid Howells 1648a1ab315SDavid Howells /* 1658a1ab315SDavid Howells * si_code values 1668a1ab315SDavid Howells * Digital reserves positive values for kernel-generated signals. 1678a1ab315SDavid Howells */ 1688a1ab315SDavid Howells #define SI_USER 0 /* sent by kill, sigsend, raise */ 1698a1ab315SDavid Howells #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 1708a1ab315SDavid Howells #define SI_QUEUE -1 /* sent by sigqueue */ 171cc731525SEric W. Biederman #define SI_TIMER -2 /* sent by timer expiration */ 172cc731525SEric W. Biederman #define SI_MESGQ -3 /* sent by real time mesq state change */ 1738a1ab315SDavid Howells #define SI_ASYNCIO -4 /* sent by AIO completion */ 174cc731525SEric W. Biederman #define SI_SIGIO -5 /* sent by queued SIGIO */ 1758a1ab315SDavid Howells #define SI_TKILL -6 /* sent by tkill system call */ 1768a1ab315SDavid Howells #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ 17775c0abb8SEric W. Biederman #define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */ 1788a1ab315SDavid Howells 1798a1ab315SDavid Howells #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) 1808a1ab315SDavid Howells #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) 1818a1ab315SDavid Howells 1828a1ab315SDavid Howells /* 1838a1ab315SDavid Howells * SIGILL si_codes 1848a1ab315SDavid Howells */ 185cc731525SEric W. Biederman #define ILL_ILLOPC 1 /* illegal opcode */ 186cc731525SEric W. Biederman #define ILL_ILLOPN 2 /* illegal operand */ 187cc731525SEric W. Biederman #define ILL_ILLADR 3 /* illegal addressing mode */ 188cc731525SEric W. Biederman #define ILL_ILLTRP 4 /* illegal trap */ 189cc731525SEric W. Biederman #define ILL_PRVOPC 5 /* privileged opcode */ 190cc731525SEric W. Biederman #define ILL_PRVREG 6 /* privileged register */ 191cc731525SEric W. Biederman #define ILL_COPROC 7 /* coprocessor error */ 192cc731525SEric W. Biederman #define ILL_BADSTK 8 /* internal stack error */ 193ac54058dSEric W. Biederman #define ILL_BADIADDR 9 /* unimplemented instruction address */ 194ac54058dSEric W. Biederman #define __ILL_BREAK 10 /* illegal break */ 195ac54058dSEric W. Biederman #define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */ 196ac54058dSEric W. Biederman #define NSIGILL 11 1978a1ab315SDavid Howells 1988a1ab315SDavid Howells /* 1998a1ab315SDavid Howells * SIGFPE si_codes 2008a1ab315SDavid Howells */ 201cc731525SEric W. Biederman #define FPE_INTDIV 1 /* integer divide by zero */ 202cc731525SEric W. Biederman #define FPE_INTOVF 2 /* integer overflow */ 203cc731525SEric W. Biederman #define FPE_FLTDIV 3 /* floating point divide by zero */ 204cc731525SEric W. Biederman #define FPE_FLTOVF 4 /* floating point overflow */ 205cc731525SEric W. Biederman #define FPE_FLTUND 5 /* floating point underflow */ 206cc731525SEric W. Biederman #define FPE_FLTRES 6 /* floating point inexact result */ 207cc731525SEric W. Biederman #define FPE_FLTINV 7 /* floating point invalid operation */ 208cc731525SEric W. Biederman #define FPE_FLTSUB 8 /* subscript out of range */ 209ac54058dSEric W. Biederman #define __FPE_DECOVF 9 /* decimal overflow */ 210ac54058dSEric W. Biederman #define __FPE_DECDIV 10 /* decimal division by zero */ 211ac54058dSEric W. Biederman #define __FPE_DECERR 11 /* packed decimal error */ 212ac54058dSEric W. Biederman #define __FPE_INVASC 12 /* invalid ASCII digit */ 213ac54058dSEric W. Biederman #define __FPE_INVDEC 13 /* invalid decimal digit */ 214266da65eSDave Martin #define FPE_FLTUNK 14 /* undiagnosed floating-point exception */ 21575abf642SHelge Deller #define FPE_CONDTRAP 15 /* trap on condition */ 21675abf642SHelge Deller #define NSIGFPE 15 2178a1ab315SDavid Howells 2188a1ab315SDavid Howells /* 2198a1ab315SDavid Howells * SIGSEGV si_codes 2208a1ab315SDavid Howells */ 221cc731525SEric W. Biederman #define SEGV_MAPERR 1 /* address not mapped to object */ 222cc731525SEric W. Biederman #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ 223cc731525SEric W. Biederman #define SEGV_BNDERR 3 /* failed address bound checks */ 224ac54058dSEric W. Biederman #ifdef __ia64__ 225ac54058dSEric W. Biederman # define __SEGV_PSTKOVF 4 /* paragraph stack overflow */ 226ac54058dSEric W. Biederman #else 227cc731525SEric W. Biederman # define SEGV_PKUERR 4 /* failed protection key checks */ 228ac54058dSEric W. Biederman #endif 229d84bb709SKhalid Aziz #define SEGV_ACCADI 5 /* ADI not enabled for mapped object */ 230d84bb709SKhalid Aziz #define SEGV_ADIDERR 6 /* Disrupting MCD error */ 231d84bb709SKhalid Aziz #define SEGV_ADIPERR 7 /* Precise MCD exception */ 232d84bb709SKhalid Aziz #define NSIGSEGV 7 2338a1ab315SDavid Howells 2348a1ab315SDavid Howells /* 2358a1ab315SDavid Howells * SIGBUS si_codes 2368a1ab315SDavid Howells */ 237cc731525SEric W. Biederman #define BUS_ADRALN 1 /* invalid address alignment */ 238cc731525SEric W. Biederman #define BUS_ADRERR 2 /* non-existent physical address */ 239cc731525SEric W. Biederman #define BUS_OBJERR 3 /* object specific hardware error */ 2408a1ab315SDavid Howells /* hardware memory error consumed on a machine check: action required */ 241cc731525SEric W. Biederman #define BUS_MCEERR_AR 4 2428a1ab315SDavid Howells /* hardware memory error detected in process but not consumed: action optional*/ 243cc731525SEric W. Biederman #define BUS_MCEERR_AO 5 2448a1ab315SDavid Howells #define NSIGBUS 5 2458a1ab315SDavid Howells 2468a1ab315SDavid Howells /* 2478a1ab315SDavid Howells * SIGTRAP si_codes 2488a1ab315SDavid Howells */ 249cc731525SEric W. Biederman #define TRAP_BRKPT 1 /* process breakpoint */ 250cc731525SEric W. Biederman #define TRAP_TRACE 2 /* process trace trap */ 251cc731525SEric W. Biederman #define TRAP_BRANCH 3 /* process taken branch trap */ 252cc731525SEric W. Biederman #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ 253db78e6a0SEric W. Biederman #define TRAP_UNK 5 /* undiagnosed trap */ 254db78e6a0SEric W. Biederman #define NSIGTRAP 5 2558a1ab315SDavid Howells 2568a1ab315SDavid Howells /* 25763300eddSRandy Dunlap * There is an additional set of SIGTRAP si_codes used by ptrace 25863300eddSRandy Dunlap * that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) 259f9886bc5SEric W. Biederman */ 260f9886bc5SEric W. Biederman 261f9886bc5SEric W. Biederman /* 2628a1ab315SDavid Howells * SIGCHLD si_codes 2638a1ab315SDavid Howells */ 264cc731525SEric W. Biederman #define CLD_EXITED 1 /* child has exited */ 265cc731525SEric W. Biederman #define CLD_KILLED 2 /* child was killed */ 266cc731525SEric W. Biederman #define CLD_DUMPED 3 /* child terminated abnormally */ 267cc731525SEric W. Biederman #define CLD_TRAPPED 4 /* traced child has trapped */ 268cc731525SEric W. Biederman #define CLD_STOPPED 5 /* child has stopped */ 269cc731525SEric W. Biederman #define CLD_CONTINUED 6 /* stopped child has continued */ 2708a1ab315SDavid Howells #define NSIGCHLD 6 2718a1ab315SDavid Howells 2728a1ab315SDavid Howells /* 273d08477aaSEric W. Biederman * SIGPOLL (or any other signal without signal specific si_codes) si_codes 2748a1ab315SDavid Howells */ 275cc731525SEric W. Biederman #define POLL_IN 1 /* data input available */ 276cc731525SEric W. Biederman #define POLL_OUT 2 /* output buffers available */ 277cc731525SEric W. Biederman #define POLL_MSG 3 /* input message available */ 278cc731525SEric W. Biederman #define POLL_ERR 4 /* i/o error */ 279cc731525SEric W. Biederman #define POLL_PRI 5 /* high priority input available */ 280cc731525SEric W. Biederman #define POLL_HUP 6 /* device disconnected */ 2818a1ab315SDavid Howells #define NSIGPOLL 6 2828a1ab315SDavid Howells 2838a1ab315SDavid Howells /* 2848a1ab315SDavid Howells * SIGSYS si_codes 2858a1ab315SDavid Howells */ 286cc731525SEric W. Biederman #define SYS_SECCOMP 1 /* seccomp triggered */ 2878a1ab315SDavid Howells #define NSIGSYS 1 2888a1ab315SDavid Howells 2898a1ab315SDavid Howells /* 290018303a9SEric W. Biederman * SIGEMT si_codes 291018303a9SEric W. Biederman */ 292018303a9SEric W. Biederman #define EMT_TAGOVF 1 /* tag overflow */ 293018303a9SEric W. Biederman #define NSIGEMT 1 294018303a9SEric W. Biederman 295018303a9SEric W. Biederman /* 2968a1ab315SDavid Howells * sigevent definitions 2978a1ab315SDavid Howells * 2988a1ab315SDavid Howells * It seems likely that SIGEV_THREAD will have to be handled from 2998a1ab315SDavid Howells * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the 3008a1ab315SDavid Howells * thread manager then catches and does the appropriate nonsense. 3018a1ab315SDavid Howells * However, everything is written out here so as to not get lost. 3028a1ab315SDavid Howells */ 3038a1ab315SDavid Howells #define SIGEV_SIGNAL 0 /* notify via signal */ 3048a1ab315SDavid Howells #define SIGEV_NONE 1 /* other notification: meaningless */ 3058a1ab315SDavid Howells #define SIGEV_THREAD 2 /* deliver via thread creation */ 3068a1ab315SDavid Howells #define SIGEV_THREAD_ID 4 /* deliver to thread */ 3078a1ab315SDavid Howells 3088a1ab315SDavid Howells /* 3098a1ab315SDavid Howells * This works because the alignment is ok on all current architectures 3108a1ab315SDavid Howells * but we leave open this being overridden in the future 3118a1ab315SDavid Howells */ 3128a1ab315SDavid Howells #ifndef __ARCH_SIGEV_PREAMBLE_SIZE 3138a1ab315SDavid Howells #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) 3148a1ab315SDavid Howells #endif 3158a1ab315SDavid Howells 3168a1ab315SDavid Howells #define SIGEV_MAX_SIZE 64 3178a1ab315SDavid Howells #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ 3188a1ab315SDavid Howells / sizeof(int)) 3198a1ab315SDavid Howells 3208a1ab315SDavid Howells typedef struct sigevent { 3218a1ab315SDavid Howells sigval_t sigev_value; 3228a1ab315SDavid Howells int sigev_signo; 3238a1ab315SDavid Howells int sigev_notify; 3248a1ab315SDavid Howells union { 3258a1ab315SDavid Howells int _pad[SIGEV_PAD_SIZE]; 3268a1ab315SDavid Howells int _tid; 3278a1ab315SDavid Howells 3288a1ab315SDavid Howells struct { 3298a1ab315SDavid Howells void (*_function)(sigval_t); 3308a1ab315SDavid Howells void *_attribute; /* really pthread_attr_t */ 3318a1ab315SDavid Howells } _sigev_thread; 3328a1ab315SDavid Howells } _sigev_un; 3338a1ab315SDavid Howells } sigevent_t; 3348a1ab315SDavid Howells 3358a1ab315SDavid Howells #define sigev_notify_function _sigev_un._sigev_thread._function 3368a1ab315SDavid Howells #define sigev_notify_attributes _sigev_un._sigev_thread._attribute 3378a1ab315SDavid Howells #define sigev_notify_thread_id _sigev_un._tid 3388a1ab315SDavid Howells 3398a1ab315SDavid Howells 3408a1ab315SDavid Howells #endif /* _UAPI_ASM_GENERIC_SIGINFO_H */ 341