irq_work: Make irq_work_queue_on() NMI-safe again
PATCH v2 1/1 irq_work: Make irq_work_queue_on() NMI-safe again
We should not put NMI unsafe code in irq_work_queue_on().
The KASAN of kasan_record_aux_stack_noalloc() is not NMI safe. Because which will call the spinlock. While the irq_work_queue_on() is also very carefully crafted to be exactly that.
When unable CONFIG_SMP or local CPU, the irq_work_queue_on() is even same to irq_work_queue(). So delete KASAN instantly.
Fixes e2b5bcf9f5ba ("irq_work: record irq_work_queue() call stack")
Suggested by: "Huang, Ying" <[email protected]>
Signed-off-by Jun Miao <[email protected]>
Acked-by Marco Elver <[email protected]>
--- kernel/irq_work.c | 3 --- 1 file changed, 3 deletions(-)
kernel/irq_work.c +0 -3
@@ -20,7 +20,6 @@#include <linux/smp.h> #include <linux/smpboot.h> #include <asm/processor.h> -#include <linux/kasan.h> static DEFINE_PER_CPU(struct llist_head, raised_list); static DEFINE_PER_CPU(struct llist_head, lazy_list);
@@ -137,8 +136,6 @@ bool irq_work_queue_on(struct irq_work *work, int cpu)if (!irq_work_claim (work))return false; -kasan_record_aux_stack_noalloc (work); -preempt_disable ();if (cpu !=smp_processor_id ()) {/* Arch remote IPI send/receive backend aren't NMI safe */
Signature · 1 line
2.32.0
Quoted 1 line · Jun Miao
We should not put NMI unsafe code in
irq_work_queue_on().
Why not, irq_work_queue_on() is not NMI safe. Only irq_work_queue() is.