From 9c1a72cd3f3d52d573876ce474b620a5f141fb1b Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 12 Apr 2016 04:39:25 +0000 Subject: [PATCH] tests: skip seccomp-strict.test and prctl-seccomp-strict.test on x32 As x86_64 kernel does not support x32 syscall numbers in SECCOMP_MODE_STRICT, skip affected tests on x32. * tests/seccomp-strict.c (main) [__x86_64__ && __ILP32__]: Bail out using error_msg_and_skip. * tests/prctl-seccomp-strict.c: Likewise. --- tests/prctl-seccomp-strict.c | 9 +++++++++ tests/seccomp-strict.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/prctl-seccomp-strict.c b/tests/prctl-seccomp-strict.c index 22db3949..0a0d6a8c 100644 --- a/tests/prctl-seccomp-strict.c +++ b/tests/prctl-seccomp-strict.c @@ -41,6 +41,14 @@ int main(void) { +# if defined __x86_64__ && defined __ILP32__ + /* + * Syscall numbers are hardcoded in + * kernel/seccomp.c:__secure_computing_strict(), + * but x32 syscall numbers are not supported. + */ + error_msg_and_skip("SECCOMP_MODE_STRICT is not supported on x32"); +# else static const char text1[] = "prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) = 0\n"; static const char text2[] = "+++ exited with 0 +++\n"; @@ -61,6 +69,7 @@ main(void) rc += write(1, text2, LENGTH_OF(text2)) != LENGTH_OF(text2); return !!syscall(__NR_exit, rc); +# endif } #else diff --git a/tests/seccomp-strict.c b/tests/seccomp-strict.c index 348bd2eb..f9fef96d 100644 --- a/tests/seccomp-strict.c +++ b/tests/seccomp-strict.c @@ -40,6 +40,14 @@ int main(void) { +# if defined __x86_64__ && defined __ILP32__ + /* + * Syscall numbers are hardcoded in + * kernel/seccomp.c:__secure_computing_strict(), + * but x32 syscall numbers are not supported. + */ + error_msg_and_skip("SECCOMP_SET_MODE_STRICT is not supported on x32"); +# else static const char text1[] = "seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = 0\n"; static const char text2[] = "+++ exited with 0 +++\n"; @@ -61,6 +69,7 @@ main(void) rc += write(1, text2, LENGTH_OF(text2)) != LENGTH_OF(text2); return !!syscall(__NR_exit, rc); +# endif } #else -- 2.40.0