This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
Best regards, Ridong
commit ee09694849a570cbc32015b5329b7c2f3f778748 Author: Chen Ridong chenridong@huawei.com Date: Thu Jul 17 08:55:50 2025 +0000
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
[ Upstream commit 14a67b42cb6f3ab66f41603c062c5056d32ea7dd ] 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. Fixes: cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") Reported-by: Zhong Jiaweizhongjiawei1@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
diff --git a/kernel/cgroup/legacy_freezer.c b/kernel/cgroup/legacy_freezer.c index 507b8f19a262e..dd9417425d929 100644 --- a/kernel/cgroup/legacy_freezer.c +++ b/kernel/cgroup/legacy_freezer.c @@ -66,15 +66,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;
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, Ridong
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Best regards, Ridong
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
> This is a note to let you know that I've just added the patch titled > > Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" > > to the 6.15-stable tree which can be found at: > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... > > The filename of the patch is: > revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch > and it can be found in the queue-6.15 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags); - if (WARN_ON_ONCE(freezing(p))) + if (!frozen(p)) goto unlock;
if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Best regards, Ridong
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: > >> This is a note to let you know that I've just added the patch titled >> >> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >> >> to the 6.15-stable tree which can be found at: >> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >> >> The filename of the patch is: >> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >> and it can be found in the queue-6.15 subdirectory. >> >> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >> > > The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to > prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
linux-stable-mirror@lists.linaro.org