Re: [PATCH] kasan: make report_lock a raw spinlock

From: Jared Kangas
Date: Fri Nov 22 2024 - 13:03:39 EST


On Thu, Nov 21, 2024 at 10:28:09PM -0800, Andrew Morton wrote:
> On Tue, 19 Nov 2024 13:02:34 -0800 Jared Kangas <jkangas@xxxxxxxxxx> wrote:
>
> > 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.
>
> So I assume we want this backported into 6.12.x?

Sorry for missing that; I think a backport of the patch would be
appropriate.

> If so, please help us identify a suitable Fixes: commit.

Fixes: 342a93247e08 ("locking/spinlock: Provide RT variant header: <linux/spinlock_rt.h>")