Patch "timers: Add missing READ_ONCE() in __run_timer_base()" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    timers: Add missing READ_ONCE() in __run_timer_base()

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     timers-add-missing-read_once-in-__run_timer_base.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f62c348949866c1c11f9b484aa652c4f2cb4745e
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date:   Wed Oct 30 08:53:51 2024 +0100

    timers: Add missing READ_ONCE() in __run_timer_base()
    
    [ Upstream commit 1d4199cbbe95efaba51304cfd844bd0ccd224e61 ]
    
    __run_timer_base() checks base::next_expiry without holding
    base::lock. That can race with a remote CPU updating next_expiry under the
    lock. This is an intentional and harmless data race, but lacks a
    READ_ONCE(), so KCSAN complains about this.
    
    Add the missing READ_ONCE(). All other places are covered already.
    
    Fixes: 79f8b28e85f8 ("timers: Annotate possible non critical data race of next_expiry")
    Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
    Link: https://lore.kernel.org/all/87a5emyqk0.ffs@tglx
    Closes: https://lore.kernel.org/oe-lkp/202410301205.ef8e9743-lkp@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 0fc9d066a7be4..7835f9b376e76 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -2422,7 +2422,8 @@ static inline void __run_timers(struct timer_base *base)
 
 static void __run_timer_base(struct timer_base *base)
 {
-	if (time_before(jiffies, base->next_expiry))
+	/* Can race against a remote CPU updating next_expiry under the lock */
+	if (time_before(jiffies, READ_ONCE(base->next_expiry)))
 		return;
 
 	timer_base_lock_expiry(base);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux