selftests/seccomp: Stop USER_NOTIF test if kcmp() fails
authorKees Cook <keescook@chromium.org>
Wed, 3 Nov 2021 16:30:38 +0000 (09:30 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 3 Nov 2021 19:02:07 +0000 (12:02 -0700)
If kcmp() fails during the USER_NOTIF test, the test is likely to hang,
so switch from EXPECT to ASSERT.

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Link: https://lore.kernel.org/r/20211103163039.2104830-2-keescook@chromium.org
tools/testing/selftests/seccomp/seccomp_bpf.c

index 1d64891e649237d3c7a47837763bff1ad066949f..d999643d577c0479ea031952b809e0832618229e 100644 (file)
@@ -4087,7 +4087,7 @@ TEST(user_notification_addfd)
         * lowest available fd to be assigned here.
         */
        EXPECT_EQ(fd, nextfd++);
-       EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0);
+       ASSERT_EQ(filecmp(getpid(), pid, memfd, fd), 0);
 
        /*
         * This sets the ID of the ADD FD to the last request plus 1. The