From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796147748; b=UaGRmZEZK4OHHgj5d6081wz6JzobiXo9uiVVovVbxcRbKAkFciKiRM2Y6qpZ7CpHURne 9eouTydduXiOXnUUCMkL4VhTBtmvr7U9Nqw377ieWNSkDgiZkOGeD5p5DVtGG3tmKhut5 NWznw0E7a9Ptp7Y8snvi8g7n7ZgJnIykjw4Vmpili9yH4ApCT5CRhQcHwZlM54wYsuIh5 DkToiGRNvA2v2a0OAP1fp8IBm6UDmhAEfC/D+bhGtic/vESuzDupJeczytxoMuRX7N3CP 16JmSU3VVYX49xsb54SN7tuEPQ2YyoOLOgvn+ktTFql+jCzvvJVwNuZKdkUKGjId93A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796147748; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-Id: In-Reply-To:References:X-Mailer:Mime-Version:Content-Type: Content-Transfer-Encoding; bh=2GjZvd2gJypJESYdqQ1Kn3GAvdQiHpAA9xcqApvdX/Q=; b=pg5CyDiEBf7d0Z6J6Eg4GdFbYsJP17OukZuPVTTNhEkYYXkrIyhTRY2BSBfbalOvqe8E ylCrGXsw/jXLsiWcKxBu20YJJWO/7dTNVM4Bz9OVZhxBgutieRJmiVqe0GqW4zaDm3AJN HuRyJ8DG/VnjGVISZqiLD0T8pRPM9ukqlgBrM7KWYe1NAl+cnLE0CEuE5cOQtN/9rA9zn LxSMyHXbyH4ix1jSKq+xYBVb6hOqgNe5zVV7CXiw6yinA+i/UCX6eEprNYjAdPmRebklz SNi7vaGrQEtGuaFbYTqpuooDNC3UOaOU3sjvoC0gap9tV1jP8igPuMB9cudk6ZaiAoA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=I84nmXpC; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29C59606A320; Tue, 1 Dec 2026 17:55:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=I84nmXpC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7179E1F000C1; Tue, 1 Dec 2026 17:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796147748; bh=2GjZvd2gJypJESYdqQ1Kn3GAvdQiHpAA9xcqApvdX/Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=I84nmXpCd9qfjicOAcyUKBVZBfOWQjAXe8OYghdTrlhktKpz0rB3LuvEeeYeskar9 UMr4TQvNomIZy4Mjknl0ijgn0lTdqbFFu4as8l6E7fDpWKKkIPDf+EhV47Nh/HsmN5 GuRes5CpLytAepx/G6tUI4RLEd+J97CvYTCGE+fM= Date: Tue, 1 Dec 2026 09:55:47 -0800 From: Andrew Morton To: Shakeel Butt Cc: Tejun Heo , Johannes Weiner , Michal Koutny , Michal Hocko , Roman Gushchin , Christian Brauner , Oleg Nesterov , Sebastian Andrzej Siewior , Suren Baghdasaryan , "T . J . Mercier" , Usama Arif , Meta kernel team , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 07/11] selftests/cgroup: test the frozen state of a cgroup with tasks and children Message-Id: <20261201095547.b8a2bdff190875397cf62a0a@linux-foundation.org> In-Reply-To: <20261130173425.4117363-8-shakeel.butt@linux.dev> References: <20261130173425.4117363-1-shakeel.butt@linux.dev> <20261130173425.4117363-8-shakeel.butt@linux.dev> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, 30 Nov 2026 09:34:21 -0800 Shakeel Butt wr= ote: > Add a test for a cgroup that has tasks of its own and a child cgroup. It > must report frozen only when its own tasks and the child are all frozen, > and it must not stay frozen after a thaw. >=20 > To get a task that the cgroup2 freezer can't stop, freeze it in a cgroup > v1 freezer hierarchy. It then sleeps in the refrigerator, where the > cgroup2 freezer can't trap it. A stopped task counts as frozen, and a > thaw doesn't wake it. The test is skipped if the v1 freezer can't be > mounted. >=20 > Without "cgroup/freezer: check own tasks and descendants for the frozen > state", the parent reports frozen=3D1 while its child is not frozen. From: Andrew Morton Subject: selftests/cgroup: check the nonleaf parent path allocation Date: Tue, 01 Dec 2026 01:38:45 -0800 The new nonleaf freezer test builds its child path from parent before checking whether cg_name() allocated parent. If that allocation fails, cg_name() calls strlen(NULL) and the entire test process segfaults before it can unmount the v1 freezer hierarchy or report a failed test. This fixes Shakeel Butt's "selftests/cgroup: test the frozen state of a cgroup with tasks and children" patch. Check parent immediately after allocating it. The cleanup path already accepts a NULL cgroup path, so the test reports failure and unmounts the v1 hierarchy. A source edit that forced the first cg_name() result to NULL made the v2 selftest segfault after TAP case 10. The fixed, injected selftest reports case 11 as failed and runs the remaining cases. Link: https://lore.kernel.org/r/20261130173425.4117363-8-shakeel.butt@linux= .dev Signed-off-by: Andrew Morton Cc: Tejun Heo Cc: Johannes Weiner Cc: Michal Koutn=FD Cc: Shuah Khan tools/testing/selftests/cgroup/test_freezer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/tools/testing/selftests/cgroup/test_freezer.c~selftests-cgroup-test-t= he-frozen-state-of-a-cgroup-with-tasks-and-children-fix +++ a/tools/testing/selftests/cgroup/test_freezer.c @@ -832,10 +832,12 @@ static int test_cgfreezer_nonleaf(const mounted =3D true; =20 parent =3D cg_name(root, "cg_test_nonleaf"); + if (!parent) + goto cleanup; child =3D cg_name(parent, "child"); staging =3D cg_name(root, "cg_test_nonleaf_staging"); v1cg =3D cg_name(v1root, "cg_test_nonleaf"); - if (!parent || !child || !staging || !v1cg) + if (!child || !staging || !v1cg) goto cleanup; =20 if (cg_create(parent) || cg_create(child) || cg_create(staging) || _