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 /* 148a1ab315SDavid Howells * This is the size (including padding) of the part of the 158a1ab315SDavid Howells * struct siginfo that is before the union. 168a1ab315SDavid Howells */ 178a1ab315SDavid Howells #ifndef __ARCH_SI_PREAMBLE_SIZE 188a1ab315SDavid Howells #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) 198a1ab315SDavid Howells #endif 208a1ab315SDavid Howells 218a1ab315SDavid Howells #define SI_MAX_SIZE 128 228a1ab315SDavid Howells #ifndef SI_PAD_SIZE 238a1ab315SDavid Howells #define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) 248a1ab315SDavid Howells #endif 258a1ab315SDavid Howells 268a1ab315SDavid Howells /* 278a1ab315SDavid Howells * The default "si_band" type is "long", as specified by POSIX. 288a1ab315SDavid Howells * However, some architectures want to override this to "int" 298a1ab315SDavid Howells * for historical compatibility reasons, so we allow that. 308a1ab315SDavid Howells */ 318a1ab315SDavid Howells #ifndef __ARCH_SI_BAND_T 328a1ab315SDavid Howells #define __ARCH_SI_BAND_T long 338a1ab315SDavid Howells #endif 348a1ab315SDavid Howells 358a1ab315SDavid Howells #ifndef __ARCH_SI_CLOCK_T 368a1ab315SDavid Howells #define __ARCH_SI_CLOCK_T __kernel_clock_t 378a1ab315SDavid Howells #endif 388a1ab315SDavid Howells 398a1ab315SDavid Howells #ifndef __ARCH_SI_ATTRIBUTES 408a1ab315SDavid Howells #define __ARCH_SI_ATTRIBUTES 418a1ab315SDavid Howells #endif 428a1ab315SDavid Howells 438a1ab315SDavid Howells typedef struct siginfo { 448a1ab315SDavid Howells int si_signo; 4509d1415dSAl Viro #ifndef __ARCH_HAS_SWAPPED_SIGINFO 468a1ab315SDavid Howells int si_errno; 478a1ab315SDavid Howells int si_code; 4809d1415dSAl Viro #else 4909d1415dSAl Viro int si_code; 5009d1415dSAl Viro int si_errno; 5109d1415dSAl Viro #endif 528a1ab315SDavid Howells 538a1ab315SDavid Howells union { 548a1ab315SDavid Howells int _pad[SI_PAD_SIZE]; 558a1ab315SDavid Howells 568a1ab315SDavid Howells /* kill() */ 578a1ab315SDavid Howells struct { 588a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 594795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 608a1ab315SDavid Howells } _kill; 618a1ab315SDavid Howells 628a1ab315SDavid Howells /* POSIX.1b timers */ 638a1ab315SDavid Howells struct { 648a1ab315SDavid Howells __kernel_timer_t _tid; /* timer id */ 658a1ab315SDavid Howells int _overrun; /* overrun count */ 668a1ab315SDavid Howells sigval_t _sigval; /* same as below */ 678a1ab315SDavid Howells int _sys_private; /* not to be passed to user */ 688a1ab315SDavid Howells } _timer; 698a1ab315SDavid Howells 708a1ab315SDavid Howells /* POSIX.1b signals */ 718a1ab315SDavid Howells struct { 728a1ab315SDavid Howells __kernel_pid_t _pid; /* sender's pid */ 734795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 748a1ab315SDavid Howells sigval_t _sigval; 758a1ab315SDavid Howells } _rt; 768a1ab315SDavid Howells 778a1ab315SDavid Howells /* SIGCHLD */ 788a1ab315SDavid Howells struct { 798a1ab315SDavid Howells __kernel_pid_t _pid; /* which child */ 804795477bSAl Viro __kernel_uid32_t _uid; /* sender's uid */ 818a1ab315SDavid Howells int _status; /* exit code */ 828a1ab315SDavid Howells __ARCH_SI_CLOCK_T _utime; 838a1ab315SDavid Howells __ARCH_SI_CLOCK_T _stime; 848a1ab315SDavid Howells } _sigchld; 858a1ab315SDavid Howells 86deaf19c0SEric W. Biederman /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGTRAP, SIGEMT */ 878a1ab315SDavid Howells struct { 888a1ab315SDavid Howells void __user *_addr; /* faulting insn/memory ref. */ 898a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 908a1ab315SDavid Howells int _trapno; /* TRAP # which caused the signal */ 918a1ab315SDavid Howells #endif 922eb50e2eSEric W. Biederman #ifdef __ia64__ 932eb50e2eSEric W. Biederman int _imm; /* immediate value for "break" */ 942eb50e2eSEric W. Biederman unsigned int _flags; /* see ia64 si_flags */ 952eb50e2eSEric W. Biederman unsigned long _isr; /* isr */ 962eb50e2eSEric W. Biederman #endif 97cd0ea35fSDave Hansen union { 98b68a68d3SEric W. Biederman /* 99b68a68d3SEric W. Biederman * used when si_code=BUS_MCEERR_AR or 100b68a68d3SEric W. Biederman * used when si_code=BUS_MCEERR_AO 101b68a68d3SEric W. Biederman */ 102b68a68d3SEric W. Biederman short _addr_lsb; /* LSB of the reported address */ 103cd0ea35fSDave Hansen /* used when si_code=SEGV_BNDERR */ 104ee1b58d3SQiaowei Ren struct { 105b68a68d3SEric W. Biederman short _dummy_bnd; 106ee1b58d3SQiaowei Ren void __user *_lower; 107ee1b58d3SQiaowei Ren void __user *_upper; 108ee1b58d3SQiaowei Ren } _addr_bnd; 109cd0ea35fSDave Hansen /* used when si_code=SEGV_PKUERR */ 110b68a68d3SEric W. Biederman struct { 111b68a68d3SEric W. Biederman short _dummy_pkey; 11249cd53bfSDave Hansen __u32 _pkey; 113b68a68d3SEric W. Biederman } _addr_pkey; 114cd0ea35fSDave Hansen }; 1158a1ab315SDavid Howells } _sigfault; 1168a1ab315SDavid Howells 1178a1ab315SDavid Howells /* SIGPOLL */ 1188a1ab315SDavid Howells struct { 1198a1ab315SDavid Howells __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 1208a1ab315SDavid Howells int _fd; 1218a1ab315SDavid Howells } _sigpoll; 1228a1ab315SDavid Howells 1238a1ab315SDavid Howells /* SIGSYS */ 1248a1ab315SDavid Howells struct { 1258a1ab315SDavid Howells void __user *_call_addr; /* calling user insn */ 1268a1ab315SDavid Howells int _syscall; /* triggering system call number */ 1278a1ab315SDavid Howells unsigned int _arch; /* AUDIT_ARCH_* of syscall */ 1288a1ab315SDavid Howells } _sigsys; 1298a1ab315SDavid Howells } _sifields; 1308a1ab315SDavid Howells } __ARCH_SI_ATTRIBUTES siginfo_t; 1318a1ab315SDavid Howells 1328a1ab315SDavid Howells /* 1338a1ab315SDavid Howells * How these fields are to be accessed. 1348a1ab315SDavid Howells */ 1358a1ab315SDavid Howells #define si_pid _sifields._kill._pid 1368a1ab315SDavid Howells #define si_uid _sifields._kill._uid 1378a1ab315SDavid Howells #define si_tid _sifields._timer._tid 1388a1ab315SDavid Howells #define si_overrun _sifields._timer._overrun 1398a1ab315SDavid Howells #define si_sys_private _sifields._timer._sys_private 1408a1ab315SDavid Howells #define si_status _sifields._sigchld._status 1418a1ab315SDavid Howells #define si_utime _sifields._sigchld._utime 1428a1ab315SDavid Howells #define si_stime _sifields._sigchld._stime 1438a1ab315SDavid Howells #define si_value _sifields._rt._sigval 1448a1ab315SDavid Howells #define si_int _sifields._rt._sigval.sival_int 1458a1ab315SDavid Howells #define si_ptr _sifields._rt._sigval.sival_ptr 1468a1ab315SDavid Howells #define si_addr _sifields._sigfault._addr 1478a1ab315SDavid Howells #ifdef __ARCH_SI_TRAPNO 1488a1ab315SDavid Howells #define si_trapno _sifields._sigfault._trapno 1498a1ab315SDavid Howells #endif 1508a1ab315SDavid Howells #define si_addr_lsb _sifields._sigfault._addr_lsb 151ee1b58d3SQiaowei Ren #define si_lower _sifields._sigfault._addr_bnd._lower 152ee1b58d3SQiaowei Ren #define si_upper _sifields._sigfault._addr_bnd._upper 153b68a68d3SEric W. Biederman #define si_pkey _sifields._sigfault._addr_pkey._pkey 1548a1ab315SDavid Howells #define si_band _sifields._sigpoll._band 1558a1ab315SDavid Howells #define si_fd _sifields._sigpoll._fd 1568a1ab315SDavid Howells #define si_call_addr _sifields._sigsys._call_addr 1578a1ab315SDavid Howells #define si_syscall _sifields._sigsys._syscall 1588a1ab315SDavid Howells #define si_arch _sifields._sigsys._arch 1598a1ab315SDavid Howells 1608a1ab315SDavid Howells /* 1618a1ab315SDavid Howells * si_code values 1628a1ab315SDavid Howells * Digital reserves positive values for kernel-generated signals. 1638a1ab315SDavid Howells */ 1648a1ab315SDavid Howells #define SI_USER 0 /* sent by kill, sigsend, raise */ 1658a1ab315SDavid Howells #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 1668a1ab315SDavid Howells #define SI_QUEUE -1 /* sent by sigqueue */ 167cc731525SEric W. Biederman #define SI_TIMER -2 /* sent by timer expiration */ 168cc731525SEric W. Biederman #define SI_MESGQ -3 /* sent by real time mesq state change */ 1698a1ab315SDavid Howells #define SI_ASYNCIO -4 /* sent by AIO completion */ 170cc731525SEric W. Biederman #define SI_SIGIO -5 /* sent by queued SIGIO */ 1718a1ab315SDavid Howells #define SI_TKILL -6 /* sent by tkill system call */ 1728a1ab315SDavid Howells #define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */ 17375c0abb8SEric W. Biederman #define SI_ASYNCNL -60 /* sent by glibc async name lookup completion */ 1748a1ab315SDavid Howells 1758a1ab315SDavid Howells #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) 1768a1ab315SDavid Howells #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) 1778a1ab315SDavid Howells 1788a1ab315SDavid Howells /* 1798a1ab315SDavid Howells * SIGILL si_codes 1808a1ab315SDavid Howells */ 181cc731525SEric W. Biederman #define ILL_ILLOPC 1 /* illegal opcode */ 182cc731525SEric W. Biederman #define ILL_ILLOPN 2 /* illegal operand */ 183cc731525SEric W. Biederman #define ILL_ILLADR 3 /* illegal addressing mode */ 184cc731525SEric W. Biederman #define ILL_ILLTRP 4 /* illegal trap */ 185cc731525SEric W. Biederman #define ILL_PRVOPC 5 /* privileged opcode */ 186cc731525SEric W. Biederman #define ILL_PRVREG 6 /* privileged register */ 187cc731525SEric W. Biederman #define ILL_COPROC 7 /* coprocessor error */ 188cc731525SEric W. Biederman #define ILL_BADSTK 8 /* internal stack error */ 189753e5a85SEric W. Biederman #ifdef __tile__ 190753e5a85SEric W. Biederman # define ILL_DBLFLT 9 /* double fault */ 191753e5a85SEric W. Biederman # define ILL_HARDWALL 10 /* user networks hardwall violation */ 192753e5a85SEric W. Biederman #endif 193ac54058dSEric W. Biederman #ifdef __ia64__ 194ac54058dSEric W. Biederman # define ILL_BADIADDR 9 /* unimplemented instruction address */ 195ac54058dSEric W. Biederman # define __ILL_BREAK 10 /* illegal break */ 196ac54058dSEric W. Biederman # define __ILL_BNDMOD 11 /* bundle-update (modification) in progress */ 197ac54058dSEric W. Biederman #endif 198ac54058dSEric W. Biederman #define NSIGILL 11 1998a1ab315SDavid Howells 2008a1ab315SDavid Howells /* 2018a1ab315SDavid Howells * SIGFPE si_codes 2028a1ab315SDavid Howells */ 203cc731525SEric W. Biederman #define FPE_INTDIV 1 /* integer divide by zero */ 204cc731525SEric W. Biederman #define FPE_INTOVF 2 /* integer overflow */ 205cc731525SEric W. Biederman #define FPE_FLTDIV 3 /* floating point divide by zero */ 206cc731525SEric W. Biederman #define FPE_FLTOVF 4 /* floating point overflow */ 207cc731525SEric W. Biederman #define FPE_FLTUND 5 /* floating point underflow */ 208cc731525SEric W. Biederman #define FPE_FLTRES 6 /* floating point inexact result */ 209cc731525SEric W. Biederman #define FPE_FLTINV 7 /* floating point invalid operation */ 210cc731525SEric W. Biederman #define FPE_FLTSUB 8 /* subscript out of range */ 2118bc9e338SEric W. Biederman #ifdef __frv__ 2128bc9e338SEric W. Biederman # define FPE_MDAOVF 9 /* media overflow */ 2138bc9e338SEric W. Biederman #endif 214ac54058dSEric W. Biederman #ifdef __ia64__ 215ac54058dSEric W. Biederman # define __FPE_DECOVF 9 /* decimal overflow */ 216ac54058dSEric W. Biederman # define __FPE_DECDIV 10 /* decimal division by zero */ 217ac54058dSEric W. Biederman # define __FPE_DECERR 11 /* packed decimal error */ 218ac54058dSEric W. Biederman # define __FPE_INVASC 12 /* invalid ASCII digit */ 219ac54058dSEric W. Biederman # define __FPE_INVDEC 13 /* invalid decimal digit */ 220ac54058dSEric W. Biederman #endif 221ac54058dSEric W. Biederman #define NSIGFPE 13 2228a1ab315SDavid Howells 2238a1ab315SDavid Howells /* 2248a1ab315SDavid Howells * SIGSEGV si_codes 2258a1ab315SDavid Howells */ 226cc731525SEric W. Biederman #define SEGV_MAPERR 1 /* address not mapped to object */ 227cc731525SEric W. Biederman #define SEGV_ACCERR 2 /* invalid permissions for mapped object */ 228cc731525SEric W. Biederman #define SEGV_BNDERR 3 /* failed address bound checks */ 229ac54058dSEric W. Biederman #ifdef __ia64__ 230ac54058dSEric W. Biederman # define __SEGV_PSTKOVF 4 /* paragraph stack overflow */ 231ac54058dSEric W. Biederman #else 232cc731525SEric W. Biederman # define SEGV_PKUERR 4 /* failed protection key checks */ 233ac54058dSEric W. Biederman #endif 234cd0ea35fSDave Hansen #define NSIGSEGV 4 2358a1ab315SDavid Howells 2368a1ab315SDavid Howells /* 2378a1ab315SDavid Howells * SIGBUS si_codes 2388a1ab315SDavid Howells */ 239cc731525SEric W. Biederman #define BUS_ADRALN 1 /* invalid address alignment */ 240cc731525SEric W. Biederman #define BUS_ADRERR 2 /* non-existent physical address */ 241cc731525SEric W. Biederman #define BUS_OBJERR 3 /* object specific hardware error */ 2428a1ab315SDavid Howells /* hardware memory error consumed on a machine check: action required */ 243cc731525SEric W. Biederman #define BUS_MCEERR_AR 4 2448a1ab315SDavid Howells /* hardware memory error detected in process but not consumed: action optional*/ 245cc731525SEric W. Biederman #define BUS_MCEERR_AO 5 2468a1ab315SDavid Howells #define NSIGBUS 5 2478a1ab315SDavid Howells 2488a1ab315SDavid Howells /* 2498a1ab315SDavid Howells * SIGTRAP si_codes 2508a1ab315SDavid Howells */ 251cc731525SEric W. Biederman #define TRAP_BRKPT 1 /* process breakpoint */ 252cc731525SEric W. Biederman #define TRAP_TRACE 2 /* process trace trap */ 253cc731525SEric W. Biederman #define TRAP_BRANCH 3 /* process taken branch trap */ 254cc731525SEric W. Biederman #define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */ 2558a1ab315SDavid Howells #define NSIGTRAP 4 2568a1ab315SDavid Howells 2578a1ab315SDavid Howells /* 258f9886bc5SEric W. Biederman * There are an additional set of SIGTRAP si_codes used by ptrace 259f9886bc5SEric W. Biederman * that of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) 260f9886bc5SEric W. Biederman */ 261f9886bc5SEric W. Biederman 262f9886bc5SEric W. Biederman /* 2638a1ab315SDavid Howells * SIGCHLD si_codes 2648a1ab315SDavid Howells */ 265cc731525SEric W. Biederman #define CLD_EXITED 1 /* child has exited */ 266cc731525SEric W. Biederman #define CLD_KILLED 2 /* child was killed */ 267cc731525SEric W. Biederman #define CLD_DUMPED 3 /* child terminated abnormally */ 268cc731525SEric W. Biederman #define CLD_TRAPPED 4 /* traced child has trapped */ 269cc731525SEric W. Biederman #define CLD_STOPPED 5 /* child has stopped */ 270cc731525SEric W. Biederman #define CLD_CONTINUED 6 /* stopped child has continued */ 2718a1ab315SDavid Howells #define NSIGCHLD 6 2728a1ab315SDavid Howells 2738a1ab315SDavid Howells /* 274d08477aaSEric W. Biederman * SIGPOLL (or any other signal without signal specific si_codes) si_codes 2758a1ab315SDavid Howells */ 276cc731525SEric W. Biederman #define POLL_IN 1 /* data input available */ 277cc731525SEric W. Biederman #define POLL_OUT 2 /* output buffers available */ 278cc731525SEric W. Biederman #define POLL_MSG 3 /* input message available */ 279cc731525SEric W. Biederman #define POLL_ERR 4 /* i/o error */ 280cc731525SEric W. Biederman #define POLL_PRI 5 /* high priority input available */ 281cc731525SEric W. Biederman #define POLL_HUP 6 /* device disconnected */ 2828a1ab315SDavid Howells #define NSIGPOLL 6 2838a1ab315SDavid Howells 2848a1ab315SDavid Howells /* 2858a1ab315SDavid Howells * SIGSYS si_codes 2868a1ab315SDavid Howells */ 287cc731525SEric W. Biederman #define SYS_SECCOMP 1 /* seccomp triggered */ 2888a1ab315SDavid Howells #define NSIGSYS 1 2898a1ab315SDavid Howells 2908a1ab315SDavid Howells /* 2918a1ab315SDavid Howells * sigevent definitions 2928a1ab315SDavid Howells * 2938a1ab315SDavid Howells * It seems likely that SIGEV_THREAD will have to be handled from 2948a1ab315SDavid Howells * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the 2958a1ab315SDavid Howells * thread manager then catches and does the appropriate nonsense. 2968a1ab315SDavid Howells * However, everything is written out here so as to not get lost. 2978a1ab315SDavid Howells */ 2988a1ab315SDavid Howells #define SIGEV_SIGNAL 0 /* notify via signal */ 2998a1ab315SDavid Howells #define SIGEV_NONE 1 /* other notification: meaningless */ 3008a1ab315SDavid Howells #define SIGEV_THREAD 2 /* deliver via thread creation */ 3018a1ab315SDavid Howells #define SIGEV_THREAD_ID 4 /* deliver to thread */ 3028a1ab315SDavid Howells 3038a1ab315SDavid Howells /* 3048a1ab315SDavid Howells * This works because the alignment is ok on all current architectures 3058a1ab315SDavid Howells * but we leave open this being overridden in the future 3068a1ab315SDavid Howells */ 3078a1ab315SDavid Howells #ifndef __ARCH_SIGEV_PREAMBLE_SIZE 3088a1ab315SDavid Howells #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t)) 3098a1ab315SDavid Howells #endif 3108a1ab315SDavid Howells 3118a1ab315SDavid Howells #define SIGEV_MAX_SIZE 64 3128a1ab315SDavid Howells #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \ 3138a1ab315SDavid Howells / sizeof(int)) 3148a1ab315SDavid Howells 3158a1ab315SDavid Howells typedef struct sigevent { 3168a1ab315SDavid Howells sigval_t sigev_value; 3178a1ab315SDavid Howells int sigev_signo; 3188a1ab315SDavid Howells int sigev_notify; 3198a1ab315SDavid Howells union { 3208a1ab315SDavid Howells int _pad[SIGEV_PAD_SIZE]; 3218a1ab315SDavid Howells int _tid; 3228a1ab315SDavid Howells 3238a1ab315SDavid Howells struct { 3248a1ab315SDavid Howells void (*_function)(sigval_t); 3258a1ab315SDavid Howells void *_attribute; /* really pthread_attr_t */ 3268a1ab315SDavid Howells } _sigev_thread; 3278a1ab315SDavid Howells } _sigev_un; 3288a1ab315SDavid Howells } sigevent_t; 3298a1ab315SDavid Howells 3308a1ab315SDavid Howells #define sigev_notify_function _sigev_un._sigev_thread._function 3318a1ab315SDavid Howells #define sigev_notify_attributes _sigev_un._sigev_thread._attribute 3328a1ab315SDavid Howells #define sigev_notify_thread_id _sigev_un._tid 3338a1ab315SDavid Howells 3348a1ab315SDavid Howells 3358a1ab315SDavid Howells #endif /* _UAPI_ASM_GENERIC_SIGINFO_H */ 336