[Devel] [PATCH RHEL10 COMMIT] ms/Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 19 16:46:47 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.18.vz10
------>
commit e0e8548ec29b899ea430dba9fb33efd3cc79af0f
Author: Chen Ridong <chenridong at huawei.com>
Date:   Wed Nov 19 11:36:42 2025 +0800

    ms/Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
    
    This reverts commit cff5f49d433fcd0063c8be7dd08fa5bf190c6c37.
    
    Commit cff5f49d433f ("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 cff5f49d433f ("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 cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not
    frozen") to complete the fix.
    
    mFixes: cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen")
    Reported-by: Zhong Jiawei<zhongjiawei1 at huawei.com>
    Signed-off-by: Chen Ridong <chenridong at huawei.com>
    Signed-off-by: Tejun Heo <tj at kernel.org>
    
    https://virtuozzo.atlassian.net/browse/VSTOR-118578
    (cherry picked from commit 14a67b42cb6f3ab66f41603c062c5056d32ea7dd)
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Feature: fix ms/freeze
---
 kernel/cgroup/legacy_freezer.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/cgroup/legacy_freezer.c b/kernel/cgroup/legacy_freezer.c
index 10b643dd570db..b048f6b530688 100644
--- a/kernel/cgroup/legacy_freezer.c
+++ b/kernel/cgroup/legacy_freezer.c
@@ -71,15 +71,9 @@ static struct freezer *parent_freezer(struct freezer *freezer)
 bool cgroup_freezing(struct task_struct *task)
 {
 	bool ret;
-	unsigned int state;
 
 	rcu_read_lock();
-	/* Check if the cgroup is still FREEZING, but not FROZEN. The extra
-	 * !FROZEN check is required, because the FREEZING bit is not cleared
-	 * when the state FROZEN is reached.
-	 */
-	state = task_freezer(task)->state;
-	ret = (state & CGROUP_FREEZING) && !(state & CGROUP_FROZEN);
+	ret = task_freezer(task)->state & CGROUP_FREEZING;
 	rcu_read_unlock();
 
 	return ret;


More information about the Devel mailing list