[Devel] [PATCH vz10 v2 0/1] selftests/core: fix unshare_test with large fs.nr_open
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 14 19:18:51 MSK 2026
unshare_test assumes fs.nr_open is close to the default 1048576, but
systemd bumps it to its largest possible value on boot (e.g.
1073741816) since v240, which makes the test's dup2() past nr_open
try to allocate a ~1 billion entry fd table and fail with ENOMEM.
Changes from v1:
- v1 capped nr_open in place and reused the same buffer (buf/n) both
for the capped test value and for the original fs.nr_open readout,
so the "restore fs.nr_open" write done by the child before calling
unshare() ended up writing the capped value back instead of the
real original one. Since fs.nr_open is a global, non-namespaced
sysctl, this permanently lowered it on any system where it was
originally set above 1 MiB, as a side effect of running the test.
- v2 keeps buf/n untouched as the real original value and caps only
the local nr_open variable used for the test's own arithmetic. The
child still restores the capped baseline before calling unshare()
(that's still needed to trigger EMFILE), but we now additionally
restore the real original fs.nr_open value in the parent once the
test has completed, so the test no longer leaves the sysctl
modified after a run.
Eva Kurchatova (1):
selftests/core: fix unshare_test with large fs.nr_open
tools/testing/selftests/core/unshare_test.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
--
2.43.0
More information about the Devel
mailing list