linux/tools/testing/selftests/namespaces
Ricardo B. Marlière (SUSE) dcacab904f
selftests/namespaces: Fix racy pipe handshake in timens and pidns_separate
In timens_separate and pidns_separate both the child and the grandchild
write a 'Y' readiness byte to the same pipe, but the parent expects a
single 'Y' followed by the grandchild's pid. If the grandchild's byte
arrives first, the parent takes it for the child's and reads the pid
misaligned, ending up with a garbage value.

The parent stores that pid in self->grandchild_pid so that
FIXTURE_TEARDOWN() can kill the grandchild. A garbage pid leaves the real
grandchild alive in pause(), holding the test runner's TAP pipe open and
hanging the whole collection.

The grandchild has nothing to report, so drop its write() and leave the
child as the sole writer.

Fixes: fdb48976b6 ("selftests/namespaces: Kill grandchild in nsid fixture teardown")
Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@marliere.net>
Link: https://patch.msgid.link/20260810-selftests-namespaces_race-v1-1-4307e833783e@marliere.net
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-13 12:20:42 +02:00
..
.gitignore selftests/namespaces: test for efault 2025-11-10 15:53:56 +01:00
config selftests/namespaces: add identifier selftests 2025-09-19 14:26:16 +02:00
cred_change_test.c selftests/namespace: commit_creds() active reference tests 2025-11-03 17:41:24 +01:00
file_handle_test.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
init_ino_test.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
listns_efault_test.c selftests/namespaces: Skip efault tests when listns() is not available 2026-05-11 12:25:32 +02:00
listns_pagination_bug.c selftests/namespace: test listns() pagination 2025-11-03 17:41:25 +01:00
listns_permissions_test.c selftests/namespaces: seventh listns() permission test 2025-11-03 17:41:22 +01:00
listns_test.c selftests/namespaces: ninth listns() test 2025-11-03 17:41:21 +01:00
Makefile selftests/namespaces: test for efault 2025-11-10 15:53:56 +01:00
ns_active_ref_test.c selftests/namespace: third threaded active reference count test 2025-11-03 17:41:24 +01:00
nsid_test.c selftests/namespaces: Fix racy pipe handshake in timens and pidns_separate 2026-08-13 12:20:42 +02:00
regression_pidfd_setns_test.c selftests/namespaces: add active reference count regression test 2025-11-10 10:20:54 +01:00
siocgskns_test.c selftests/namespaces: twelth inactive namespace resurrection test 2025-11-03 17:41:24 +01:00
stress_test.c selftests/namespace: add stress test 2025-11-03 17:41:25 +01:00
wrappers.h selftests/namespaces: add listns() wrapper 2025-11-03 17:41:20 +01:00