diff options
author | Kees Cook <keescook@chromium.org> | 2017-09-07 19:32:46 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2017-09-25 12:09:05 -0400 |
commit | 10859f3855db4c6f10dc7974ff4b3a292f3de8e0 (patch) | |
tree | 4156aa0d798033c0161608c3e6c598815b97ee66 | |
parent | 659dbfd8c47adeb03f401d1a1f17091bb63cc5a2 (diff) |
selftests/seccomp: Support glibc 2.26 siginfo_t.h
The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
work-around to using the kernel definition are no longer needed. The old
way needs to stay around for a while, though.
Reported-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r-- | tools/testing/selftests/seccomp/seccomp_bpf.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 4d6f92a9df6b..19cd272c234d 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c | |||
@@ -6,10 +6,18 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <sys/types.h> | 8 | #include <sys/types.h> |
9 | #include <asm/siginfo.h> | 9 | |
10 | #define __have_siginfo_t 1 | 10 | /* |
11 | #define __have_sigval_t 1 | 11 | * glibc 2.26 and later have SIGSYS in siginfo_t. Before that, |
12 | #define __have_sigevent_t 1 | 12 | * we need to use the kernel's siginfo.h file and trick glibc |
13 | * into accepting it. | ||
14 | */ | ||
15 | #if !__GLIBC_PREREQ(2, 26) | ||
16 | # include <asm/siginfo.h> | ||
17 | # define __have_siginfo_t 1 | ||
18 | # define __have_sigval_t 1 | ||
19 | # define __have_sigevent_t 1 | ||
20 | #endif | ||
13 | 21 | ||
14 | #include <errno.h> | 22 | #include <errno.h> |
15 | #include <linux/filter.h> | 23 | #include <linux/filter.h> |
@@ -676,7 +684,7 @@ TEST_F_SIGNAL(TRAP, ign, SIGSYS) | |||
676 | syscall(__NR_getpid); | 684 | syscall(__NR_getpid); |
677 | } | 685 | } |
678 | 686 | ||
679 | static struct siginfo TRAP_info; | 687 | static siginfo_t TRAP_info; |
680 | static volatile int TRAP_nr; | 688 | static volatile int TRAP_nr; |
681 | static void TRAP_action(int nr, siginfo_t *info, void *void_context) | 689 | static void TRAP_action(int nr, siginfo_t *info, void *void_context) |
682 | { | 690 | { |