public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] pidns32: fix PID namespace nesting depth off-by-one
@ 2026-03-30 10:07 Vasileios Almpanis via ltp
  2026-03-30 10:23 ` Andrea Cervesato via ltp
  2026-03-30 13:33 ` Petr Vorel
  0 siblings, 2 replies; 4+ messages in thread
From: Vasileios Almpanis via ltp @ 2026-03-30 10:07 UTC (permalink / raw)
  To: ltp

The 2023 refactor used tst_atomic_inc() before clone with a zero-initial
counter, which only performed 31 CLONE_NEWPID nests while still expecting
MAXNEST (32). Compare the level to MAXNEST first, then increment and clone,
so the shared counter runs 0..32 and the chain reaches 32 nested namespaces
again.

Fixes: 647cfd468c3b ("Refactor pidns32 test using new LTP API")
Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
---
 testcases/kernel/containers/pidns/pidns32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/containers/pidns/pidns32.c b/testcases/kernel/containers/pidns/pidns32.c
index fc9bf0aaa..3a272f569 100644
--- a/testcases/kernel/containers/pidns/pidns32.c
+++ b/testcases/kernel/containers/pidns/pidns32.c
@@ -27,9 +27,11 @@ static pid_t child_func(void)
 {
 	pid_t cpid = 0;
 
-	if (tst_atomic_inc(level) == MAXNEST)
+	if (tst_atomic_load(level) == MAXNEST)
 		return cpid;
 
+	tst_atomic_inc(level);
+
 	cpid = SAFE_CLONE(&args);
 	if (!cpid) {
 		child_func();
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-30 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 10:07 [LTP] [PATCH] pidns32: fix PID namespace nesting depth off-by-one Vasileios Almpanis via ltp
2026-03-30 10:23 ` Andrea Cervesato via ltp
2026-03-30 13:33 ` Petr Vorel
2026-03-30 14:42   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox