| #
76d46ad2 |
| 26-Feb-2026 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: add CLONE_AUTOREAP tests
Add tests for the new CLONE_AUTOREAP clone3() flag:
- autoreap_without_pidfd: CLONE_AUTOREAP without CLONE_PIDFD works (fire-and-forget) - autoreap_rejec
selftests/pidfd: add CLONE_AUTOREAP tests
Add tests for the new CLONE_AUTOREAP clone3() flag:
- autoreap_without_pidfd: CLONE_AUTOREAP without CLONE_PIDFD works (fire-and-forget) - autoreap_rejects_exit_signal: CLONE_AUTOREAP with non-zero exit_signal fails - autoreap_rejects_parent: CLONE_AUTOREAP with CLONE_PARENT fails - autoreap_rejects_thread: CLONE_AUTOREAP with CLONE_THREAD fails - autoreap_basic: child exits, pidfd poll works, PIDFD_GET_INFO returns correct exit code, waitpid() returns -ECHILD - autoreap_signaled: child killed by signal, exit info correct via pidfd - autoreap_reparent: autoreap grandchild reparented to subreaper still auto-reaps - autoreap_multithreaded: autoreap process with sub-threads auto-reaps after last thread exits - autoreap_no_inherit: grandchild forked without CLONE_AUTOREAP becomes a regular zombie
Link: https://patch.msgid.link/20260226-work-pidfs-autoreap-v5-4-d148b984a989@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
914e6b1e |
| 24-Jun-2025 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: decode pidfd file handles withou having to specify an fd
Link: https://lore.kernel.org/20250624-work-pidfs-fhandle-v2-11-d02a04858fe3@kernel.org Reviewed-by: Jan Kara <jack@suse.cz>
selftests/pidfd: decode pidfd file handles withou having to specify an fd
Link: https://lore.kernel.org/20250624-work-pidfs-fhandle-v2-11-d02a04858fe3@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
8c2ab041 |
| 18-Jun-2025 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: test setattr support
Verify that ->setattr() on a pidfd doens't work.
Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-15-98f3456fd552@kernel.org Reviewed-by: Alexan
selftests/pidfd: test setattr support
Verify that ->setattr() on a pidfd doens't work.
Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-15-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
49fba372 |
| 18-Jun-2025 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: test extended attribute support
Add tests for extended attribute support on pidfds.
Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-13-98f3456fd552@kernel.org Revie
selftests/pidfd: test extended attribute support
Add tests for extended attribute support on pidfds.
Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-13-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
56f235da |
| 05-Mar-2025 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: add seventh PIDFD_INFO_EXIT selftest
Add a selftest for PIDFD_INFO_EXIT behavior.
Link: https://lore.kernel.org/r/20250305-work-pidfs-kill_on_last_close-v3-16-c8c3d8361705@kernel.o
selftests/pidfd: add seventh PIDFD_INFO_EXIT selftest
Add a selftest for PIDFD_INFO_EXIT behavior.
Link: https://lore.kernel.org/r/20250305-work-pidfs-kill_on_last_close-v3-16-c8c3d8361705@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
853ab1ff |
| 05-Mar-2025 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: add first PIDFD_INFO_EXIT selftest
Add a selftest for PIDFD_INFO_EXIT behavior.
Link: https://lore.kernel.org/r/20250305-work-pidfs-kill_on_last_close-v3-10-c8c3d8361705@kernel.org
selftests/pidfd: add first PIDFD_INFO_EXIT selftest
Add a selftest for PIDFD_INFO_EXIT behavior.
Link: https://lore.kernel.org/r/20250305-work-pidfs-kill_on_last_close-v3-10-c8c3d8361705@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
f63df616 |
| 19-Dec-2024 |
Christian Brauner <brauner@kernel.org> |
selftests: add pidfd bind-mount tests
Link: https://lore.kernel.org/r/20241219-work-pidfs-mount-v1-2-dbc56198b839@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
|
| #
59a42b0e |
| 02-Dec-2024 |
Christian Brauner <brauner@kernel.org> |
selftests/pidfd: add pidfs file handle selftests
Add selftests for pidfs file handles.
Link: https://lore.kernel.org/r/20241202-imstande-einsicht-d78753e1c632@brauner Reviewed-by: Amir Goldstein <a
selftests/pidfd: add pidfs file handle selftests
Add selftests for pidfs file handles.
Link: https://lore.kernel.org/r/20241202-imstande-einsicht-d78753e1c632@brauner Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
show more ...
|
| #
3f7d7176 |
| 27-Jan-2023 |
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
selftests: pidfd: Fix incorrect kernel headers search path
Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents building against kernel headers from the build environment in scenari
selftests: pidfd: Fix incorrect kernel headers search path
Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents building against kernel headers from the build environment in scenarios where kernel headers are installed into a specific output directory (O=...).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Shuah Khan <shuah@kernel.org> Cc: linux-kselftest@vger.kernel.org Cc: Ingo Molnar <mingo@redhat.com> Cc: <stable@vger.kernel.org> # 5.18+ Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| #
3d982441 |
| 01-Sep-2022 |
Li Zhijian <lizhijian@fujitsu.com> |
selftests: pidfd: Fix compling warnings
Fix warnings and enable Wall.
pidfd_wait.c: In function ‘wait_nonblock’: pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable] 150 |
selftests: pidfd: Fix compling warnings
Fix warnings and enable Wall.
pidfd_wait.c: In function ‘wait_nonblock’: pidfd_wait.c:150:13: warning: unused variable ‘status’ [-Wunused-variable] 150 | int pidfd, status = 0; | ^~~~~~ ... pidfd_test.c: In function ‘child_poll_exec_test’: pidfd_test.c:438:1: warning: no return statement in function returning non-void [-Wreturn-type] 438 | } | ^
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> v2: fix mistake assignment to pidfd Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
show more ...
|
| #
2b40c5db |
| 05-May-2020 |
Christian Brauner <christian.brauner@ubuntu.com> |
selftests/pidfd: add pidfd setns tests
This is basically a test-suite for setns() and as of now contains: - test that we can't pass garbage flags - test that we can't attach to the namespaces of ta
selftests/pidfd: add pidfd setns tests
This is basically a test-suite for setns() and as of now contains: - test that we can't pass garbage flags - test that we can't attach to the namespaces of task that has already exited - test that we can incrementally setns into all namespaces of a target task using a pidfd - test that we can setns atomically into all namespaces of a target task - test that we can't cross setns into a user namespace outside of our user namespace hierarchy - test that we can't setns into namespaces owned by user namespaces over which we are not privileged
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Link: https://lore.kernel.org/r/20200505140432.181565-4-christian.brauner@ubuntu.com
show more ...
|
| #
873dfd78 |
| 07-Jan-2020 |
Sargun Dhillon <sargun@sargun.me> |
test: Add test for pidfd getfd
The following tests: * Fetch FD, and then compare via kcmp * Make sure getfd can be blocked by blocking ptrace_may_access * Making sure fetching bad FDs fails
test: Add test for pidfd getfd
The following tests: * Fetch FD, and then compare via kcmp * Make sure getfd can be blocked by blocking ptrace_may_access * Making sure fetching bad FDs fails * Make sure trying to set flags to non-zero results in an EINVAL
Signed-off-by: Sargun Dhillon <sargun@sargun.me> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Link: https://lore.kernel.org/r/20200107175927.4558-5-sargun@sargun.me Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
show more ...
|
| #
2def297e |
| 14-Oct-2019 |
Christian Kellner <christian@kellner.me> |
pidfd: add tests for NSpid info in fdinfo
Add a test that checks that if pid namespaces are configured the fdinfo file of a pidfd contains an NSpid: entry containing the process id in the current an
pidfd: add tests for NSpid info in fdinfo
Add a test that checks that if pid namespaces are configured the fdinfo file of a pidfd contains an NSpid: entry containing the process id in the current and additionally all nested namespaces. In the case that a pidfd is from a pid namespace not in the same namespace hierarchy as the process accessing the fdinfo file, ensure the 'NSpid' shows 0 for that pidfd, analogous to the 'Pid' entry.
Signed-off-by: Christian Kellner <christian@kellner.me> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Link: https://lore.kernel.org/r/20191014162034.2185-2-ckellner@redhat.com Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
show more ...
|
| #
3969e769 |
| 24-Sep-2019 |
Shuah Khan <skhan@linuxfoundation.org> |
selftests: pidfd: Fix undefined reference to pthread_create()
Fix build failure:
undefined reference to `pthread_create' collect2: error: ld returned 1 exit status
Fix CFLAGS to include pthread co
selftests: pidfd: Fix undefined reference to pthread_create()
Fix build failure:
undefined reference to `pthread_create' collect2: error: ld returned 1 exit status
Fix CFLAGS to include pthread correctly.
Fixes: 740378dc7834 ("pidfd: add polling selftests") Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20190924195237.30519-1-skhan@linuxfoundation.org Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
show more ...
|
| #
aed5a8df |
| 26-Jul-2019 |
Suren Baghdasaryan <surenb@google.com> |
tests: add pidfd poll tests
This adds testing for polling on pidfd of a process being killed. Test runs 10000 iterations by default to stress test pidfd polling functionality. It accepts an optional
tests: add pidfd poll tests
This adds testing for polling on pidfd of a process being killed. Test runs 10000 iterations by default to stress test pidfd polling functionality. It accepts an optional command-line parameter to override the number or iterations to run. Specifically, it tests for: - pidfd_open on a child process succeeds - pidfd_send_signal on a child process succeeds - polling on pidfd succeeds and returns exactly one event - returned event is POLLIN - event is received within 3 secs of the process being killed
10000 iterations was chosen because of the race condition being tested which is not consistently reproducible but usually is revealed after less than 2000 iterations. Reveals race fixed by commit b191d6491be6 ("pidfd: fix a poll race when setting exit_state")
Signed-off-by: Suren Baghdasaryan <surenb@google.com> Link: https://lore.kernel.org/r/20190726162226.252750-2-surenb@google.com Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
show more ...
|
| #
e63f3085 |
| 28-Jul-2019 |
Christian Brauner <christian.brauner@ubuntu.com> |
pidfd: add pidfd_wait tests
Add tests for pidfd_wait() and CLONE_WAIT_PID: - test that waitid(P_PIDFD) fails on /proc/<pid> - test that waitid(P_PIDFD) fails on /dev/null - test that waitid(P_PIDFD)
pidfd: add pidfd_wait tests
Add tests for pidfd_wait() and CLONE_WAIT_PID: - test that waitid(P_PIDFD) fails on /proc/<pid> - test that waitid(P_PIDFD) fails on /dev/null - test that waitid(P_PIDFD) can wait on a pidfd - test that waitid(P_PIDFD) can wait on a pidfd and return siginfo_t - test that waitid(P_PIDFD) works with WEXITED - test that waitid(P_PIDFD) works with WSTOPPED - test that waitid(P_PIDFD) works with WUNTRACED - test that waitid(P_PIDFD) works with WCONTINUED - test that waitid(P_PIDFD) works with WNOWAIT - test that waitid(P_PIDFD)works with WNOHANG
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Joel Fernandes (Google) <joel@joelfernandes.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: David Howells <dhowells@redhat.com> 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: Linus Torvalds <torvalds@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Link: https://lore.kernel.org/r/20190727222229.6516-3-christian@brauner.io
show more ...
|
| #
172bb24a |
| 23-Mar-2019 |
Christian Brauner <christian@brauner.io> |
tests: add pidfd_open() tests
This adds testing for the new pidfd_open() syscalls. Specifically, we test: - that no invalid flags can be passed to pidfd_open() - that no invalid pid can be passed to
tests: add pidfd_open() tests
This adds testing for the new pidfd_open() syscalls. Specifically, we test: - that no invalid flags can be passed to pidfd_open() - that no invalid pid can be passed to pidfd_open() - that a pidfd can be retrieved with pidfd_open() - that the retrieved pidfd references the correct pid
Signed-off-by: Christian Brauner <christian@brauner.io> Cc: Arnd Bergmann <arnd@arndb.de> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Kees Cook <keescook@chromium.org> Cc: Joel Fernandes (Google) <joel@joelfernandes.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jann Horn <jannh@google.com> Cc: David Howells <dhowells@redhat.com> Cc: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.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: Linus Torvalds <torvalds@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-api@vger.kernel.org
show more ...
|
| #
740378dc |
| 30-Apr-2019 |
Joel Fernandes (Google) <joel@joelfernandes.org> |
pidfd: add polling selftests
Other than verifying pidfd based polling, the tests make sure that wait semantics are preserved with the pidfd poll. Notably the 2 cases: 1. If a thread group leader exi
pidfd: add polling selftests
Other than verifying pidfd based polling, the tests make sure that wait semantics are preserved with the pidfd poll. Notably the 2 cases: 1. If a thread group leader exits while threads still there, then no pidfd poll notifcation should happen. 2. If a non-thread group leader does an execve, then the thread group leader is signaled to exit and is replaced with the execing thread as the new leader, however the parent is not notified in this case.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Christian Brauner <christian@brauner.io>
show more ...
|
| #
575a0ae9 |
| 29-Dec-2018 |
Christian Brauner <christian@brauner.io> |
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 whethe
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>
show more ...
|