Patch "kasan: make report_lock a raw spinlock" has been added to the 6.1-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

    kasan: make report_lock a raw spinlock

to the 6.1-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:
     kasan-make-report_lock-a-raw-spinlock.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 464468fa29f9244613add91dd38810189c07b54b
Author: Jared Kangas <jkangas@xxxxxxxxxx>
Date:   Tue Nov 19 13:02:34 2024 -0800

    kasan: make report_lock a raw spinlock
    
    [ Upstream commit e30a0361b8515d424c73c67de1a43e45a13b8ba2 ]
    
    If PREEMPT_RT is enabled, report_lock is a sleeping spinlock and must not
    be locked when IRQs are disabled.  However, KASAN reports may be triggered
    in such contexts.  For example:
    
            char *s = kzalloc(1, GFP_KERNEL);
            kfree(s);
            local_irq_disable();
            char c = *s;  /* KASAN report here leads to spin_lock() */
            local_irq_enable();
    
    Make report_spinlock a raw spinlock to prevent rescheduling when
    PREEMPT_RT is enabled.
    
    Link: https://lkml.kernel.org/r/20241119210234.1602529-1-jkangas@xxxxxxxxxx
    Fixes: 342a93247e08 ("locking/spinlock: Provide RT variant header: <linux/spinlock_rt.h>")
    Signed-off-by: Jared Kangas <jkangas@xxxxxxxxxx>
    Cc: Alexander Potapenko <glider@xxxxxxxxxx>
    Cc: Andrey Konovalov <andreyknvl@xxxxxxxxx>
    Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx>
    Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
    Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 821cd12e8c8a7..6ad986c267b5e 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -173,7 +173,7 @@ static void update_kunit_status(bool sync)
 static void update_kunit_status(bool sync) { }
 #endif
 
-static DEFINE_SPINLOCK(report_lock);
+static DEFINE_RAW_SPINLOCK(report_lock);
 
 static void start_report(unsigned long *flags, bool sync)
 {
@@ -185,7 +185,7 @@ static void start_report(unsigned long *flags, bool sync)
 	lockdep_off();
 	/* Make sure we don't end up in loop. */
 	report_suppress_start();
-	spin_lock_irqsave(&report_lock, *flags);
+	raw_spin_lock_irqsave(&report_lock, *flags);
 	pr_err("==================================================================\n");
 }
 
@@ -195,7 +195,7 @@ static void end_report(unsigned long *flags, void *addr)
 		trace_error_report_end(ERROR_DETECTOR_KASAN,
 				       (unsigned long)addr);
 	pr_err("==================================================================\n");
-	spin_unlock_irqrestore(&report_lock, *flags);
+	raw_spin_unlock_irqrestore(&report_lock, *flags);
 	if (!test_bit(KASAN_BIT_MULTI_SHOT, &kasan_flags))
 		check_panic_on_warn("KASAN");
 	if (kasan_arg_fault == KASAN_ARG_FAULT_PANIC)




[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