[LTP] [PATCH v1] cgroup_core01.c: Set umask before create directory

Andrea Cervesato andrea.cervesato@suse.com
Mon Feb 12 12:54:01 CET 2024


Hi!
LGTM

Reviewed-by: Andrea Cervesato <andrea.cervesato.suse.com>

On 12/4/23 01:26, Wei Gao via ltp wrote:
> Some specific build's default mask is 0077, this will trigger issue if
> you create directory with A but switch B to access it. Such as following
> failed message will popup in current case:
> cgroup_core01.c:50: TBROK: openat(21</sys/fs/cgroup/memory/ltp/test-3519/child_b>, 'tasks', 2, 0): EACCES (13)
>
> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
>   testcases/kernel/controllers/cgroup/cgroup_core01.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_core01.c b/testcases/kernel/controllers/cgroup/cgroup_core01.c
> index 2e695deed..0deff6209 100644
> --- a/testcases/kernel/controllers/cgroup/cgroup_core01.c
> +++ b/testcases/kernel/controllers/cgroup/cgroup_core01.c
> @@ -38,6 +38,7 @@ static void test_lesser_euid_open(void)
>   	int fds[TST_CG_ROOTS_MAX] = {-1};
>   	int i, loops;
>   
> +	umask(0022);
>   	cg_child_a = tst_cg_group_mk(tst_cg, "child_a");
>   	cg_child_b = tst_cg_group_mk(tst_cg, "child_b");
>   




More information about the ltp mailing list