linux-stable/kernel/cgroup
Tim Van Patten 9ec2d92673 cgroup_freezer: cgroup_freezing: Check if not frozen
commit cff5f49d43 upstream.

__thaw_task() was recently updated to warn if the task being thawed was
part of a freezer cgroup that is still currently freezing:

	void __thaw_task(struct task_struct *p)
	{
	...
		if (WARN_ON_ONCE(freezing(p)))
			goto unlock;

This has exposed a bug in cgroup1 freezing where when CGROUP_FROZEN is
asserted, the CGROUP_FREEZING bits are not also cleared at the same
time. Meaning, when a cgroup is marked FROZEN it continues to be marked
FREEZING as well. This causes the WARNING to trigger, because
cgroup_freezing() thinks the cgroup is still freezing.

There are two ways to fix this:

1. Whenever FROZEN is set, clear FREEZING for the cgroup and all
children cgroups.
2. Update cgroup_freezing() to also verify that FROZEN is not set.

This patch implements option (2), since it's smaller and more
straightforward.

Signed-off-by: Tim Van Patten <timvp@google.com>
Tested-by: Mark Hasemeyer <markhas@chromium.org>
Fixes: f5d39b0208 ("freezer,sched: Rewrite core freezer logic")
Cc: stable@vger.kernel.org # v6.1+
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-13 18:45:22 +01:00
..
cgroup-internal.h cgroup: make cgroup_is_threaded() and cgroup_is_thread_root() static 2023-06-05 10:31:41 -10:00
cgroup-v1.c cgroup: Remove duplicates in cgroup v1 tasks file 2023-10-09 06:42:05 -10:00
cgroup.c sched: psi: fix unprivileged polling against cgroups 2023-11-28 17:19:56 +00:00
cpuset.c cgroup/cpuset: Fix load balance state in update_partition_sd_lb() 2023-11-20 11:58:53 +01:00
debug.c kernel: cgroup: fix misuse of %x 2019-05-06 08:47:48 -07:00
freezer.c cgroup: cleanup comments 2022-03-13 19:19:27 -10:00
legacy_freezer.c cgroup_freezer: cgroup_freezing: Check if not frozen 2023-12-13 18:45:22 +01:00
Makefile cgroup: Add misc cgroup controller 2021-04-04 13:34:46 -04:00
misc.c cgroup/misc: Store atomic64_t reads to u64 2023-07-21 08:10:06 -10:00
namespace.c cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-08-14 14:29:47 -10:00
pids.c cgroup: add pids.peak interface for pids controller 2022-09-04 09:26:51 -10:00
rdma.c rdmacg: fix kernel-doc warnings in rdmacg 2023-06-05 09:45:14 -10:00
rstat.c cgroup/rstat: Record the cumulative per-cpu time of cgroup and its descendants 2023-08-07 08:41:25 -10:00