selftests/seccomp: Handle namespace failures gracefully
authorKees Cook <keescook@chromium.org>
Thu, 11 Apr 2019 23:56:31 +0000 (16:56 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 16 Apr 2019 23:04:08 +0000 (17:04 -0600)
commit9dd3fcb0ab73cb1e00b8562ef027a38521aaff87
tree6f1a971fc65ad50b3759c272dce909e834b3aeb4
parente14d314c7a489f060d6d691866fef5f131281718
selftests/seccomp: Handle namespace failures gracefully

When running without USERNS or PIDNS the seccomp test would hang since
it was waiting forever for the child to trigger the user notification
since it seems the glibc() abort handler makes a call to getpid(),
which would trap again. This changes the getpid filter to getppid, and
makes sure ASSERTs execute to stop from spawning the listener.

Reported-by: Shuah Khan <shuah@kernel.org>
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Cc: stable@vger.kernel.org # > 5.0
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Tycho Andersen <tycho@tycho.ws>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/seccomp/seccomp_bpf.c