From: sashiko-bot@kernel.org
To: "Shakeel Butt" <shakeel.butt@linux.dev>, "Tejun Heo" <tj@kernel.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutny" <mkoutny@suse.com>,
"Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Christian Brauner" <brauner@kernel.org>,
"Oleg Nesterov" <oleg@redhat.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Suren Baghdasaryan" <surenb@google.com>,
"T . J . Mercier" <tjmercier@google.com>,
"Usama Arif" <usama.arif@linux.dev>,
"Meta kernel team" <kernel-team@meta.com>,
linux-mm@kvack.org
Subject: Re: [PATCH v2 07/11] selftests/cgroup: test the frozen state of a cgroup with tasks and children
Date: Tue, 01 Dec 2026 17:36:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-243864@kernel.org> (raw)
In-Reply-To: <20261130173425.4117363-8-shakeel.butt@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/cgroup: NULL dereference in test_cgfreezer_nonleaf()
via cg_name()
--
commit 7a7c35569fc5e5295d8f0e537256fc64e4ab3eb7
Author: Shakeel Butt <shakeel.butt@linux.dev>
selftests/cgroup: test the frozen state of a cgroup with tasks and children
This commit adds a cgroup freezer selftest verifying that a cgroup with both
its own tasks and a child cgroup reports frozen only when all of its tasks
and descendants are frozen.
> diff --git a/tools/testing/selftests/cgroup/test_freezer.c b/tools/testing/selftests/cgroup/test_freezer.c
> index 266b1a0f889f5..e24e977424921 100644
> --- a/tools/testing/selftests/cgroup/test_freezer.c
> +++ b/tools/testing/selftests/cgroup/test_freezer.c
[ ... ]
> @@ -804,6 +805,109 @@ static int test_cgfreezer_vfork(const char *root)
> return ret;
> }
>
> +/*
> + * A cgroup with tasks of its own and child cgroups is frozen only once its
> + * tasks and all its descendants are frozen.
> + *
> + * A task frozen in a cgroup v1 freezer hierarchy sleeps in the refrigerator,
> + * where the cgroup v2 freezer can't trap it, so its v2 cgroup can't freeze
> + * until it is thawed. A stopped task counts as frozen and isn't woken by a
> + * thaw.
> + */
> +static int test_cgfreezer_nonleaf(const char *root)
> +{
> + char *parent = NULL, *child = NULL, *staging = NULL, *v1cg = NULL;
> + char v1root[] = "/tmp/cg_test_freezer_v1_XXXXXX";
> + int ret = KSFT_FAIL, frozen_pid, stopped_pid, i;
> + bool mounted = false;
> +
> + if (!mkdtemp(v1root))
> + return KSFT_FAIL;
> +
> + if (mount("none", v1root, "cgroup", 0, "freezer")) {
> + debug("Can't mount the cgroup v1 freezer\n");
> + ret = KSFT_SKIP;
> + goto cleanup;
> + }
> + mounted = true;
> +
> + parent = cg_name(root, "cg_test_nonleaf");
> + child = cg_name(parent, "child");
> + staging = cg_name(root, "cg_test_nonleaf_staging");
> + v1cg = cg_name(v1root, "cg_test_nonleaf");
> + if (!parent || !child || !staging || !v1cg)
> + goto cleanup;
[Severity: Low]
Can cg_name(parent, "child") dereference a NULL pointer if the allocation
for parent fails? cg_name() unconditionally calls strlen() on its first
argument, while parent is only checked for NULL after child is constructed.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130173425.4117363-1-shakeel.butt@linux.dev?part=7
next prev parent reply other threads:[~2026-12-01 17:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:34 [PATCH v2 00/11] cgroup: don't hold cgroup_mutex for cgroup.kill and cgroup.freeze Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 01/11] cgroup: don't lose a task in css_task_iter when a migration fails Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 02/11] cgroup: kill a child forked while cgroup.kill runs Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 03/11] cgroup/freezer: check own tasks and descendants for the frozen state Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 04/11] cgroup/freezer: don't update the frozen state of removed cgroups Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 05/11] cgroup/freezer: test the freeze trap bit under siglock Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 06/11] selftests/cgroup: test cgroup.procs reads across a failed migration Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 07/11] selftests/cgroup: test the frozen state of a cgroup with tasks and children Shakeel Butt
2026-12-01 17:36 ` sashiko-bot [this message]
2026-12-01 17:55 ` Andrew Morton
2026-11-30 17:34 ` [PATCH v2 08/11] selftests/cgroup: test cgroup.kill in a threaded cgroup Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 09/11] cgroup: factor out cgroup_kn_break_active() and cgroup_kn_unbreak_active() Shakeel Butt
2026-11-30 17:34 ` [PATCH v2 10/11] cgroup: don't hold cgroup_mutex for cgroup.kill Shakeel Butt
2026-12-01 17:36 ` sashiko-bot
2026-12-01 17:55 ` Andrew Morton
2026-12-01 17:56 ` Andrew Morton
2026-11-30 17:34 ` [PATCH v2 11/11] cgroup/freezer: don't hold cgroup_mutex for cgroup.freeze Shakeel Butt
2026-12-01 17:36 ` sashiko-bot
2026-12-01 17:56 ` Andrew Morton
2026-12-01 17:55 ` [PATCH v2 00/11] cgroup: don't hold cgroup_mutex for cgroup.kill and cgroup.freeze Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-243864@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=brauner@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=oleg@redhat.com \
--cc=roman.gushchin@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=tjmercier@google.com \
--cc=usama.arif@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox