* [PATCH] selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice
@ 2026-05-11 6:15 Tao Cui
2026-05-11 8:36 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Tao Cui @ 2026-05-11 6:15 UTC (permalink / raw)
To: tj, hannes, mkoutny, shuah, cgroups; +Cc: Tao Cui
In test_cpucg_nice, the forked child process incorrectly jumps to the
parent's cleanup label on cg_write failure. This causes the child to
attempt cg_destroy on cgroups the parent is still using, and then
return to main() to continue executing tests as if it were the parent.
Replace goto cleanup with exit(EXIT_FAILURE) in the child process.
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
tools/testing/selftests/cgroup/test_cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
index c83f05438d7c..7a40d76b9548 100644
--- a/tools/testing/selftests/cgroup/test_cpu.c
+++ b/tools/testing/selftests/cgroup/test_cpu.c
@@ -278,7 +278,7 @@ static int test_cpucg_nice(const char *root)
char buf[64];
snprintf(buf, sizeof(buf), "%d", getpid());
if (cg_write(cpucg, "cgroup.procs", buf))
- goto cleanup;
+ exit(EXIT_FAILURE);
/* Try to keep niced CPU usage as constrained to hog_cpu as possible */
nice(1);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice
2026-05-11 6:15 [PATCH] selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice Tao Cui
@ 2026-05-11 8:36 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-05-11 8:36 UTC (permalink / raw)
To: Tao Cui; +Cc: hannes, mkoutny, shuah, cgroups
Hello,
Applied to cgroup/for-7.2.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-11 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 6:15 [PATCH] selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice Tao Cui
2026-05-11 8:36 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox