Skip to content

Commit 95a126d

Browse files
Yang Guangkees
authored andcommitted
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
1 parent d250a3e commit 95a126d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/testing/selftests/seccomp/seccomp_bpf.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,10 @@ TEST(user_notification_fault_recv)
37433743
struct seccomp_notif req = {};
37443744
struct seccomp_notif_resp resp = {};
37453745

3746-
ASSERT_EQ(unshare(CLONE_NEWUSER), 0);
3746+
ASSERT_EQ(unshare(CLONE_NEWUSER), 0) {
3747+
if (errno == EINVAL)
3748+
SKIP(return, "kernel missing CLONE_NEWUSER support");
3749+
}
37473750

37483751
listener = user_notif_syscall(__NR_getppid,
37493752
SECCOMP_FILTER_FLAG_NEW_LISTENER);

0 commit comments

Comments
 (0)