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

Petr Vorel pvorel@suse.cz
Wed Jan 7 17:06:56 CET 2026


> Hi!
> > > > Sure, .needs_kconfigs is used when test request some functionality based on
> > > > kconfig.  But many tests use /proc or /sys based detection (e.g. ioctl_ns06.c)
> > > > or based on certain errno, see include/lapi/syscalls.h or
> > > > testcases/kernel/syscalls/fanotify/fanotify.h) because these were
> > > > added before LTP supported kconfig. Later, when kconfig was added it was
> > > > considering as a last resort (when there was no way to detect dependency
> > > > otherwise).

> > > > Have we decide to move everything into kconfig?

> > > > I'm not sure myself.  needs_kconfigs is simpler and obvious, but it requires
> > > > kernel config.  I suppose the speed of parsing config is not an issue.

> > > > It'd be nice to mention the resolution (preferred vs. only if no other way to
> > > > detect the support) into
> > > > https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html

> > > Feel free to add this comment, but for me it's obvious that if a
> > > feature can't be present in the kernel due to kconfigs we should check
> > > kconfig :-)

> > I've just taken another look at this and it appears the test would still
> > fail if the config is not present or if KCONFIG_SKIP_CHECK is set, in
> > which case perhaps the run time detection may be preferred as it will
> > still work in these cases?

> The KCONFIG_SKIP_CHECK is a flag aimed at developers, it shouldn't be
> enabled in production testing.

> As for the missing config there is 95 testcases that have needs_kconfigs
> set at this moment and the number is growing steadily. I would argue
> that you cannot run LTP without having config available. And the config
> location is autodetected on common distributions as well.

> > Would it be better to have the run time detection in tst_kconfig_check
> > as a fall back in case the config is not present?
> > Then the tests can just define the needs_kconfigs and not have to worry
> > about other checks.

> I would avoid any complexity that isn't strictly necessary, the less we
> do, the less breakage we have to deal with later. In that sense adding
> the needs_kconfigs and expect the config to be there is probably the
> most straightforward solution.

Thanks for your input. I understand that you're for replacing in ioctl_ns06.c:

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

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

with .needs_kconfigs:

	.needs_kconfigs = (const char *[]) {
		"CONFIG_USER_NS",
		NULL
	}

Because that was my question - really always prefer kconfig even there is a
simple runtime solution? I'd like to have some "rule" like conclusion we can
point during review.

Kind regards,
Petr


More information about the ltp mailing list