selftests: add tests for pidfd_send_signal()
authorChristian Brauner <christian@brauner.io>
Sat, 29 Dec 2018 21:27:33 +0000 (22:27 +0100)
committerChristian Brauner <christian@brauner.io>
Tue, 5 Mar 2019 16:04:33 +0000 (17:04 +0100)
commit575a0ae9744d571f7c6aae4487a05850baae9e1c
tree1a0a89a61e0db7064fa195b23947e1baa86b63f0
parent3eb39f47934f9d5a3027fe00d906a45fe3a15fad
selftests: add tests for pidfd_send_signal()

As suggested by Andrew Morton in [1] add selftests for the new
sys_pidfd_send_signal() syscall:

/* test_pidfd_send_signal_syscall_support */
Test whether the pidfd_send_signal() syscall is supported and the tests can
be run or need to be skipped.

/* test_pidfd_send_signal_simple_success */
Test whether sending a signal via a pidfd works.

/* test_pidfd_send_signal_exited_fail */
Verify that sending a signal to an already exited process fails with ESRCH.

/* test_pidfd_send_signal_recycled_pid_fail */
Verify that a recycled pid cannot be signaled via a pidfd referring to an
already exited process that had the same pid (cf. [2], [3]).

[1]: https://lore.kernel.org/lkml/20181228152012.dbf0508c2508138efc5f2bbe@linux-foundation.org/
[2]: https://lore.kernel.org/lkml/20181230210245.GA30252@mail.hallyn.com/
[3]: https://lore.kernel.org/lkml/20181230232711.7aayb7vnhogbv4co@brauner.io/

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jann Horn <jannh@google.com>
Cc: Andy Lutomirsky <luto@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Christian Brauner <christian@brauner.io>
Reviewed-by: Tycho Andersen <tycho@tycho.ws>
Acked-by: Serge Hallyn <serge@hallyn.com>
tools/testing/selftests/Makefile
tools/testing/selftests/pidfd/Makefile [new file with mode: 0644]
tools/testing/selftests/pidfd/pidfd_test.c [new file with mode: 0644]