linux-yocto/kernel/cgroup
Chen Ridong f371ad6471 Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
[ Upstream commit 14a67b42cb ]

This reverts commit cff5f49d43.

Commit cff5f49d43 ("cgroup_freezer: cgroup_freezing: Check if not
frozen") modified the cgroup_freezing() logic to verify that the FROZEN
flag is not set, affecting the return value of the freezing() function,
in order to address a warning in __thaw_task.

A race condition exists that may allow tasks to escape being frozen. The
following scenario demonstrates this issue:

CPU 0 (get_signal path)		CPU 1 (freezer.state reader)
try_to_freeze			read freezer.state
__refrigerator			freezer_read
				update_if_frozen
WRITE_ONCE(current->__state, TASK_FROZEN);
				...
				/* Task is now marked frozen */
				/* frozen(task) == true */
				/* Assuming other tasks are frozen */
				freezer->state |= CGROUP_FROZEN;
/* freezing(current) returns false */
/* because cgroup is frozen (not freezing) */
break out
__set_current_state(TASK_RUNNING);
/* Bug: Task resumes running when it should remain frozen */

The existing !frozen(p) check in __thaw_task makes the
WARN_ON_ONCE(freezing(p)) warning redundant. Removing this warning enables
reverting the commit cff5f49d43 ("cgroup_freezer: cgroup_freezing: Check
if not frozen") to resolve the issue.

The warning has been removed in the previous patch. This patch revert the
commit cff5f49d43 ("cgroup_freezer: cgroup_freezing: Check if not
frozen") to complete the fix.

Fixes: cff5f49d43 ("cgroup_freezer: cgroup_freezing: Check if not frozen")
Reported-by: Zhong Jiawei<zhongjiawei1@huawei.com>
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-24 08:53:20 +02:00
..
cgroup-internal.h cgroup: Make operations on the cgroup root_list RCU safe 2024-08-19 06:04:25 +02:00
cgroup-v1.c kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to strscpy() 2024-08-03 08:53:21 +02:00
cgroup.c cgroup: Fix compilation issue due to cgroup_mutex not being exported 2025-06-04 14:41:53 +02:00
cpuset.c cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks 2025-05-22 14:12:12 +02:00
debug.c
freezer.c
legacy_freezer.c Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" 2025-07-24 08:53:20 +02:00
Makefile
misc.c
namespace.c
pids.c
rdma.c
rstat.c cgroup: Remove steal time from usage_usec 2025-02-21 13:57:08 +01:00