From: Greg Kroah-Hartman Date: Tue, 22 Jul 2025 12:38:53 +0000 (+0200) Subject: 6.12-stable patches X-Git-Tag: v6.1.147~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98a75ee7d8b9d3a2d41e9aaf8bf1adeeb7d75454;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: sched-freezer-remove-unnecessary-warning-in-__thaw_task.patch --- diff --git a/queue-6.12/sched-freezer-remove-unnecessary-warning-in-__thaw_task.patch b/queue-6.12/sched-freezer-remove-unnecessary-warning-in-__thaw_task.patch new file mode 100644 index 0000000000..ccbfe0cd93 --- /dev/null +++ b/queue-6.12/sched-freezer-remove-unnecessary-warning-in-__thaw_task.patch @@ -0,0 +1,74 @@ +From 9beb8c5e77dc10e3889ff5f967eeffba78617a88 Mon Sep 17 00:00:00 2001 +From: Chen Ridong +Date: Thu, 17 Jul 2025 08:55:49 +0000 +Subject: sched,freezer: Remove unnecessary warning in __thaw_task + +From: Chen Ridong + +commit 9beb8c5e77dc10e3889ff5f967eeffba78617a88 upstream. + +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 commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if +not frozen") to resolve the issue. + +This patch removes the warning from __thaw_task. A subsequent patch will +revert commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if +not frozen") to complete the fix. + +Reported-by: Zhong Jiawei +Signed-off-by: Chen Ridong +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +--- + kernel/freezer.c | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + +--- a/kernel/freezer.c ++++ b/kernel/freezer.c +@@ -201,18 +201,9 @@ static int __restore_freezer_state(struc + + void __thaw_task(struct task_struct *p) + { +- unsigned long flags; +- +- spin_lock_irqsave(&freezer_lock, flags); +- if (WARN_ON_ONCE(freezing(p))) +- goto unlock; +- +- if (!frozen(p) || task_call_func(p, __restore_freezer_state, NULL)) +- goto unlock; +- +- wake_up_state(p, TASK_FROZEN); +-unlock: +- spin_unlock_irqrestore(&freezer_lock, flags); ++ guard(spinlock_irqsave)(&freezer_lock); ++ if (frozen(p) && !task_call_func(p, __restore_freezer_state, NULL)) ++ wake_up_state(p, TASK_FROZEN); + } + + /** diff --git a/queue-6.12/series b/queue-6.12/series index f672cdd9b3..d1bf1f85ca 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -152,3 +152,4 @@ i2c-omap-add-support-for-setting-mux.patch i2c-omap-fix-an-error-handling-path-in-omap_i2c_probe.patch i2c-omap-handle-omap_i2c_init-errors-in-omap_i2c_probe.patch i2c-omap-fix-deprecated-of_property_read_bool-use.patch +sched-freezer-remove-unnecessary-warning-in-__thaw_task.patch