FAILED: patch "[PATCH] kasan: make report_lock a raw spinlock" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x e30a0361b8515d424c73c67de1a43e45a13b8ba2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024121008-yelling-swear-a95b@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e30a0361b8515d424c73c67de1a43e45a13b8ba2 Mon Sep 17 00:00:00 2001
From: Jared Kangas <[email protected]>
Date: Tue, 19 Nov 2024 13:02:34 -0800
Subject: [PATCH] kasan: make report_lock a raw spinlock
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.
mm/kasan/report.c +3 -3
@@ -201,7 +201,7 @@ static inline void fail_non_kasan_kunit_test(void) { }#endif /* CONFIG_KUNIT */ -static DEFINE_SPINLOCK (report_lock); +static DEFINE_RAW_SPINLOCK (report_lock);static void start_report (unsigned long *flags,bool sync) {
@@ -212,7 +212,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" ); }
@@ -222,7 +222,7 @@ static void end_report(unsigned long *flags, const void *addr, bool is_write)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" );switch (kasan_arg_fault) {