[LTP] [PATCH] cgroup_core02: modernize test using LTP cgroup API
Cyril Hrubis
chrubis@suse.cz
Thu Oct 1 15:56:34 CEST 2026
Hi!
> cgroup_core02 tests that when a task writes to an fd opened by a
> different task, the permission check uses the cgroup namespace of
> the opening task (regression test for CVE-2021-4197).
>
> Modernize the test to align with current LTP coding standards:
>
> - Replace TEST()/TST_RET/TST_ERR pattern with TST_EXP_FAIL(), which
> provides cleaner error checking and better formatted test output.
>
> - Replace manual tst_res(TFAIL,...) + exit(1) on clone/fd failure
> with tst_brk(TBROK,...), which is the correct way to abort on an
> unexpected infrastructure failure inside a forked child.
>
> - Drop unused variable 'int status' and pass NULL to SAFE_WAITPID()
> since the clone child exit status is not inspected.
>
> - Remove redundant and unused headers: <stdlib.h>, <stdio.h>,
> <sys/types.h> and "tst_safe_file_at.h".
>
> - Expand the test header comment to use the [Description]/[Algorithm]
> block format required by current LTP documentation standards.
>
> - Fix minor whitespace issues: extra spaces in SAFE_CG_FCHOWN() calls,
> struct initializer brace, and .needs_cgroup_ctrls array initializer.
While these changes does sound reasonable.
> No functional change to the test logic.
>
> Signed-off-by: Sushmitha <sushmita@linux.ibm.com>
> ---
> cgroup_core02.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 131 insertions(+)
> create mode 100644 cgroup_core02.c
This patch is completely wrong, it just add new file with the
modifications. The patch should include only differencies between the
current code in git and the updated version.
So first of all you should learn how to checkout a git repository and
generate proper patches.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list