lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJqdLro5Mtr_JRXnPehxEErY9L=rxAb-iXavAPqKxp1fTto-rw@mail.gmail.com>
Date: Tue, 4 Nov 2025 09:53:01 +0100
From: Alexander Mikhalitsyn <alexander@...alicyn.com>
To: Christian Brauner <brauner@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>, 
	Amir Goldstein <amir73il@...il.com>, Aleksa Sarai <cyphar@...har.com>, 
	Yu Watanabe <watanabe.yu+github@...il.com>, Josef Bacik <josef@...icpanda.com>, 
	Jeff Layton <jlayton@...nel.org>, Jann Horn <jannh@...gle.com>, 
	Luca Boccassi <luca.boccassi@...il.com>, linux-kernel@...r.kernel.org, 
	Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, 
	Lennart Poettering <lennart@...ttering.net>, Mike Yuan <me@...dnzj.com>, 
	Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>
Subject: Re: [PATCH 10/22] selftests/pidfd: add first supported_mask test

Am Di., 28. Okt. 2025 um 09:46 Uhr schrieb Christian Brauner
<brauner@...nel.org>:
>
> Verify that when PIDFD_INFO_SUPPORTED_MASK is requested, the kernel
> returns the supported_mask field indicating which flags the kernel
> supports.
>
> Signed-off-by: Christian Brauner <brauner@...nel.org>

Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>

> ---
>  tools/testing/selftests/pidfd/pidfd_info_test.c | 41 +++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/tools/testing/selftests/pidfd/pidfd_info_test.c b/tools/testing/selftests/pidfd/pidfd_info_test.c
> index a0eb6e81eaa2..b31a0597fbae 100644
> --- a/tools/testing/selftests/pidfd/pidfd_info_test.c
> +++ b/tools/testing/selftests/pidfd/pidfd_info_test.c
> @@ -690,4 +690,45 @@ TEST_F(pidfd_info, thread_group_exec_thread)
>         EXPECT_EQ(close(pidfd_thread), 0);
>  }
>
> +/*
> + * Test: PIDFD_INFO_SUPPORTED_MASK field
> + *
> + * Verify that when PIDFD_INFO_SUPPORTED_MASK is requested, the kernel
> + * returns the supported_mask field indicating which flags the kernel supports.
> + */
> +TEST(supported_mask_field)
> +{
> +       struct pidfd_info info = {
> +               .mask = PIDFD_INFO_SUPPORTED_MASK,
> +       };
> +       int pidfd;
> +       pid_t pid;
> +
> +       pid = create_child(&pidfd, 0);
> +       ASSERT_GE(pid, 0);
> +
> +       if (pid == 0)
> +               pause();
> +
> +       /* Request supported_mask field */
> +       ASSERT_EQ(ioctl(pidfd, PIDFD_GET_INFO, &info), 0);
> +
> +       /* Verify PIDFD_INFO_SUPPORTED_MASK is set in the reply */
> +       ASSERT_TRUE(!!(info.mask & PIDFD_INFO_SUPPORTED_MASK));
> +
> +       /* Verify supported_mask contains expected flags */
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_PID));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_CREDS));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_CGROUPID));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_EXIT));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_COREDUMP));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_SUPPORTED_MASK));
> +       ASSERT_TRUE(!!(info.supported_mask & PIDFD_INFO_COREDUMP_SIGNAL));
> +
> +       /* Clean up */
> +       sys_pidfd_send_signal(pidfd, SIGKILL, NULL, 0);
> +       sys_waitid(P_PIDFD, pidfd, NULL, WEXITED);
> +       close(pidfd);
> +}
> +
>  TEST_HARNESS_MAIN
>
> --
> 2.47.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ