Re: [LTP] [PATCH] ioctl_pidfd02-06: Add CONFIG_USER_NS and CONFIG_PID_NS to needs_kconfigs

Petr Vorel
2025-12-15T15:54:00Z

Hi all,

> The flags CLONE_NEWUSER and CLONE_NEWPID require specific namespace support.
> Add CONFIG_USER_NS and CONFIG_PID_NS to needs_kconfigs so these tests return
> TCONF instead of failing.

> Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
> ---
> testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c | 5 +++++
> testcases/kernel/syscalls/ioctl/ioctl_pidfd03.c | 5 +++++
> testcases/kernel/syscalls/ioctl/ioctl_pidfd04.c | 5 +++++
> testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c | 5 +++++
> testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 5 +++++
> 5 files changed, 25 insertions(+)

> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c
> index 7eb60e7fc..6983259e4 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c
> @@ -81,5 +81,10 @@ static struct tst_test test = {
> {&info0, .size = sizeof(*info0)},
> {&info1, .size = sizeof(*info1)},
> {}
> + },
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_USER_NS",
> + "CONFIG_PID_NS",

How about to check /proc/self/ns/user and /proc/self/ns/pid as ioctl_ns06.c
does?

int exists = access("/proc/self/ns/user", F_OK);

if (exists < 0)
tst_res(TCONF, "namespace not available");

Long time ago we tried to avoid forcing config. Is it now considered as better?
(maybe more readable?) Or we would keep checking /proc (or /sys) but add a
comment for required functions?

Kind regards,
Petr

> + NULL