From: Christian Brauner Date: Thu, 3 Apr 2025 14:09:04 +0000 (+0200) Subject: selftest/pidfd: add test for thread-group leader pidfd open for thread X-Git-Tag: v6.16-rc1~220^2~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fc3f73c16dae0211f31a963eedfb921f8366f57;p=thirdparty%2Flinux.git selftest/pidfd: add test for thread-group leader pidfd open for thread Verify that we report ENOENT when userspace tries to create a thread-group leader pidfd for a thread pidfd that isn't a thread-group leader. Link: https://lore.kernel.org/r/20250403-work-pidfd-fixes-v1-4-a123b6ed6716@kernel.org Reviewed-by: Oleg Nesterov Signed-off-by: Christian Brauner --- diff --git a/tools/testing/selftests/pidfd/pidfd_info_test.c b/tools/testing/selftests/pidfd/pidfd_info_test.c index accfd6bdc539e..a0eb6e81eaa26 100644 --- a/tools/testing/selftests/pidfd/pidfd_info_test.c +++ b/tools/testing/selftests/pidfd/pidfd_info_test.c @@ -299,6 +299,7 @@ TEST_F(pidfd_info, thread_group) /* Opening a thread as a thread-group leader must fail. */ pidfd_thread = sys_pidfd_open(pid_thread, 0); ASSERT_LT(pidfd_thread, 0); + ASSERT_EQ(errno, ENOENT); /* Opening a thread as a PIDFD_THREAD must succeed. */ pidfd_thread = sys_pidfd_open(pid_thread, PIDFD_THREAD);