summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Guang <yang.guang5@zte.com.cn>2022-03-30 03:22:10 +0300
committerKees Cook <keescook@chromium.org>2022-04-29 21:28:43 +0300
commit95a126d9812ff51f7ff3e42d956390ff9a1801f8 (patch)
tree2da16c9c8aaa408f8f05da8fbaeb5ec34edcaf05
parentd250a3e4e5b41d9d805a8bfd2458b548d1681742 (diff)
downloadlinux-95a126d9812ff51f7ff3e42d956390ff9a1801f8.tar.xz
selftests/seccomp: Add SKIP for failed unshare()
Running the seccomp tests under the kernel with "defconfig" shouldn't fail. Because the CONFIG_USER_NS is not supported in "defconfig". Skipping this case instead of failing it is better. Signed-off-by: Yang Guang <yang.guang5@zte.com.cn> Signed-off-by: David Yang <davidcomponentone@gmail.com> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/7f7687696a5c0a2d040a24474616e945c7cf2bb5.1648599460.git.yang.guang5@zte.com.cn
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 4da905180f89..38839ad939f8 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -3743,7 +3743,10 @@ TEST(user_notification_fault_recv)
struct seccomp_notif req = {};
struct seccomp_notif_resp resp = {};
- ASSERT_EQ(unshare(CLONE_NEWUSER), 0);
+ ASSERT_EQ(unshare(CLONE_NEWUSER), 0) {
+ if (errno == EINVAL)
+ SKIP(return, "kernel missing CLONE_NEWUSER support");
+ }
listener = user_notif_syscall(__NR_getppid,
SECCOMP_FILTER_FLAG_NEW_LISTENER);