]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/namespaces: Kill grandchild in nsid fixture teardown
authorRicardo B. Marlière <rbm@suse.com>
Tue, 7 Apr 2026 14:35:45 +0000 (11:35 -0300)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 10:25:31 +0000 (12:25 +0200)
commitfdb48976b6379c2b91e1ad4aafef07ee8b1ddb0e
tree0daf5c19e486d315b505b342dcdceaf1080e1972
parent6f43b87876197e4b2eb7d4564f5dd082c981e92a
selftests/namespaces: Kill grandchild in nsid fixture teardown

The timens_separate and pidns_separate test cases fork a grandchild that
calls pause().  FIXTURE_TEARDOWN only kills the direct child, which is the
init process of the grandchild's namespace.  Once the child (init) exits,
the grandchild is reparented to the host init but remains alive and
continues to hold the inherited write end of the test runner's TAP pipe
open.  tap_prefix never receives EOF and blocks indefinitely, hanging the
entire test collection.

Record the grandchild PID in the fixture struct so that teardown can send
SIGKILL and reap it before dealing with the child.  The grandchild must be
reaped first because the child acts as its PID namespace init; killing the
child first would kill the grandchild without giving us a chance to
waitpid() it.

Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://patch.msgid.link/20260407-selftests-namespaces_fixes-v1-1-59109909d88b@suse.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/namespaces/nsid_test.c