[Devel] [PATCH VZ10 2/2] selftests/ve_ns_owner: make sure clone_child_func() does not fallthrough in parent code

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri May 15 14:53:34 MSK 2026


This is safer: _exit is guaranteed at the call site regardless of what
the function does internally. Also it makes clone_child_func() and
unshare_child_func() follow the same scheme.

https://virtuozzo.atlassian.net/browse/VSTOR-129744
Fixes: 4fe045fa7c00a ("selftests/ve: regression test for CLONE_NEWVE owner correctness")
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 tools/testing/selftests/ve/ve_ns_owner_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/ve/ve_ns_owner_test.c b/tools/testing/selftests/ve/ve_ns_owner_test.c
index d9cb66bb0df64..b5b4f10be72b9 100644
--- a/tools/testing/selftests/ve/ve_ns_owner_test.c
+++ b/tools/testing/selftests/ve/ve_ns_owner_test.c
@@ -177,11 +177,11 @@ static int clone_child_func(void *arg)
 	close(ctx->sync.parent_to_child[1]);
 
 	if (write(ctx->sync.child_to_parent[1], "R", 1) != 1)
-		_exit(11);
+		return 11;
 	if (read(ctx->sync.parent_to_child[0], &ack, 1) != 1)
-		_exit(12);
+		return 12;
 
-	_exit(0);
+	return 0;
 }
 
 /*
@@ -317,7 +317,7 @@ TEST_F(ve_ns_owner, clone_newve_newnet_newns)
 	pid = syscall(__NR_clone3, &cargs, sizeof(cargs));
 	ASSERT_GE(pid, 0);
 	if (pid == 0)
-		clone_child_func(&ctx);
+		_exit(clone_child_func(&ctx));
 
 	close(ctx.sync.child_to_parent[1]);
 	close(ctx.sync.parent_to_child[0]);
-- 
2.54.0



More information about the Devel mailing list