From: John Crispin Date: Sat, 23 May 2015 15:26:19 +0000 (+0000) Subject: uClibc: add signal info for seccomp related SIGSYS X-Git-Tag: reboot~3029 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6ab2bcfe72dbe442bf74cd4e1208367104699e00;p=openwrt%2Fstaging%2Fblogic.git uClibc: add signal info for seccomp related SIGSYS uClibc doesn't define signal info for the SIGSYS signal which is issued in case of hitting a syscall prohibited by seccomp. This is sad as it makes debugging seccomp filter policies impossible on some architectures (at least ARM and PowerPC, maybe also others) which do not coincidentally set si_value.sival_int as the syscall number. To fix this, import the definitions and macros needed from glibc. Signed-off-by: Daniel Golle SVN-Revision: 45720 --- diff --git a/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch b/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch new file mode 100644 index 000000000000..4894a56138e4 --- /dev/null +++ b/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch @@ -0,0 +1,145 @@ +Index: uClibc/libc/sysdeps/linux/common/bits/siginfo.h +=================================================================== +--- uClibc.orig/libc/sysdeps/linux/common/bits/siginfo.h ++++ uClibc/libc/sysdeps/linux/common/bits/siginfo.h +@@ -104,6 +104,14 @@ typedef struct siginfo + long int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; ++ ++ /* SIGSYS. */ ++ struct ++ { ++ void *_call_addr; /* Calling user insn. */ ++ int _syscall; /* Triggering system call number. */ ++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ } _sigsys; + } _sifields; + } siginfo_t; + +@@ -122,6 +130,9 @@ typedef struct siginfo + # define si_addr _sifields._sigfault.si_addr + # define si_band _sifields._sigpoll.si_band + # define si_fd _sifields._sigpoll.si_fd ++# define si_call_addr _sifields._sigsys._call_addr ++# define si_syscall _sifields._sigsys._syscall ++# define si_arch _sifields._sigsys._arch + + + /* Values for `si_code'. Positive values are reserved for kernel-generated +Index: uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h +=================================================================== +--- uClibc.orig/libc/sysdeps/linux/alpha/bits/siginfo.h ++++ uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h +@@ -98,6 +98,14 @@ typedef struct siginfo + int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; ++ ++ /* SIGSYS. */ ++ struct ++ { ++ void *_call_addr; /* Calling user insn. */ ++ int _syscall; /* Triggering system call number. */ ++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ } _sigsys; + } _sifields; + } siginfo_t; + +@@ -116,6 +124,9 @@ typedef struct siginfo + # define si_addr _sifields._sigfault.si_addr + # define si_band _sifields._sigpoll.si_band + # define si_fd _sifields._sigpoll.si_fd ++# define si_call_addr _sifields._sigsys._call_addr ++# define si_syscall _sifields._sigsys._syscall ++# define si_arch _sifields._sigsys._arch + + + /* Values for `si_code'. Positive values are reserved for kernel-generated +Index: uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h +=================================================================== +--- uClibc.orig/libc/sysdeps/linux/ia64/bits/siginfo.h ++++ uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h +@@ -103,6 +103,14 @@ typedef struct siginfo + long int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; ++ ++ /* SIGSYS. */ ++ struct ++ { ++ void *_call_addr; /* Calling user insn. */ ++ int _syscall; /* Triggering system call number. */ ++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ } _sigsys; + } _sifields; + } siginfo_t; + +@@ -121,6 +129,9 @@ typedef struct siginfo + # define si_addr _sifields._sigfault.si_addr + # define si_band _sifields._sigpoll.si_band + # define si_fd _sifields._sigpoll.si_fd ++# define si_call_addr _sifields._sigsys._call_addr ++# define si_syscall _sifields._sigsys._syscall ++# define si_arch _sifields._sigsys._arch + + # ifdef __USE_GNU + # define si_imm _sifields._sigfault._si_imm +Index: uClibc/libc/sysdeps/linux/mips/bits/siginfo.h +=================================================================== +--- uClibc.orig/libc/sysdeps/linux/mips/bits/siginfo.h ++++ uClibc/libc/sysdeps/linux/mips/bits/siginfo.h +@@ -107,6 +107,14 @@ typedef struct siginfo + __uid_t si_uid; /* Real user ID of sending process. */ + sigval_t si_sigval; /* Signal value. */ + } _rt; ++ ++ /* SIGSYS. */ ++ struct ++ { ++ void *_call_addr; /* Calling user insn. */ ++ int _syscall; /* Triggering system call number. */ ++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ } _sigsys; + } _sifields; + } siginfo_t; + +@@ -123,6 +131,9 @@ typedef struct siginfo + # define si_addr _sifields._sigfault.si_addr + # define si_band _sifields._sigpoll.si_band + # define si_fd _sifields._sigpoll.si_fd ++# define si_call_addr _sifields._sigsys._call_addr ++# define si_syscall _sifields._sigsys._syscall ++# define si_arch _sifields._sigsys._arch + + + /* Values for `si_code'. Positive values are reserved for kernel-generated +Index: uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h +=================================================================== +--- uClibc.orig/libc/sysdeps/linux/sparc/bits/siginfo.h ++++ uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h +@@ -105,6 +105,14 @@ typedef struct siginfo + int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; ++ ++ /* SIGSYS. */ ++ struct ++ { ++ void *_call_addr; /* Calling user insn. */ ++ int _syscall; /* Triggering system call number. */ ++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */ ++ } _sigsys; + } _sifields; + } siginfo_t; + +@@ -124,6 +132,9 @@ typedef struct siginfo + # define si_trapno _sifields._sigfault.si_trapno + # define si_band _sifields._sigpoll.si_band + # define si_fd _sifields._sigpoll.si_fd ++# define si_call_addr _sifields._sigsys._call_addr ++# define si_syscall _sifields._sigsys._syscall ++# define si_arch _sifields._sigsys._arch + + + /* Values for `si_code'. Positive values are reserved for kernel-generated