From 6668ed271eaefaa63e686bdfbedaeb7b8e492722 Mon Sep 17 00:00:00 2001 From: Kumar Kartikeya Dwivedi Date: Fri, 4 Sep 2026 10:43:19 +0200 Subject: selftests/bpf: Reject graph kptr use after RCU unlock Add a sleepable verifier test that loads a graph-node local kptr in an explicit RCU read-side critical section, then passes its node to bpf_rbtree_remove() after the section ends. Before the verifier fix, the stale NON_OWN_REF flag makes the node look like a live borrowed reference and the program is accepted. After the fix, the pointer is demoted without NON_OWN_REF and the graph kfunc argument is rejected. Also exercise a graph kptr loaded while a spin lock provides implicit RCU protection. The pointer must be invalidated when the lock is released, which guards the required ordering between non-owning-reference invalidation and RCU demotion. Update the existing fault-protected load test state description. The post-unlock pointer no longer carries NON_OWN_REF, but remains readable because the load is rewritten to use BPF_PROBE_MEM. Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20260904084325.52250-7-memxor@gmail.com Signed-off-by: Alexei Starovoitov --- arch/m68k/sun3/sun3ints.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 arch/m68k/sun3/sun3ints.c (limited to 'arch/m68k/sun3/sun3ints.c') diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c new file mode 100644 index 000000000..32eaf55f8 --- /dev/null +++ b/arch/m68k/sun3/sun3ints.c @@ -0,0 +1,100 @@ + /* + * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sun3.h" + +void sun3_disable_interrupts(void) +{ + sun3_disable_irq(0); +} + +void sun3_enable_interrupts(void) +{ + sun3_enable_irq(0); +} + +static unsigned char led_pattern[8] = { + (u8)~(0x80), (u8)~(0x01), + (u8)~(0x40), (u8)~(0x02), + (u8)~(0x20), (u8)~(0x04), + (u8)~(0x10), (u8)~(0x08) +}; + +volatile unsigned char* sun3_intreg; + +void sun3_enable_irq(unsigned int irq) +{ + *sun3_intreg |= (1 << irq); +} + +void sun3_disable_irq(unsigned int irq) +{ + *sun3_intreg &= ~(1 << irq); +} + +static irqreturn_t sun3_int7(int irq, void *dev_id) +{ + unsigned int cnt; + + cnt = kstat_irqs_cpu(irq, 0); + if (!(cnt % 2000)) + sun3_leds(led_pattern[cnt % 16000 / 2000]); + return IRQ_HANDLED; +} + +static irqreturn_t sun3_int5(int irq, void *dev_id) +{ + unsigned long flags; + unsigned int cnt; + + local_irq_save(flags); +#ifdef CONFIG_SUN3 + intersil_clear(); +#endif + sun3_disable_irq(5); + sun3_enable_irq(5); +#ifdef CONFIG_SUN3 + intersil_clear(); +#endif + legacy_timer_tick(1); + cnt = kstat_irqs_cpu(irq, 0); + if (!(cnt % 20)) + sun3_leds(led_pattern[cnt % 160 / 20]); + local_irq_restore(flags); + return IRQ_HANDLED; +} + +static irqreturn_t sun3_vec255(int irq, void *dev_id) +{ + return IRQ_HANDLED; +} + +void __init sun3_init_IRQ(void) +{ + *sun3_intreg = 1; + + m68k_setup_user_interrupt(VEC_USER, 128); + + if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL)) + pr_err("Couldn't register %s interrupt\n", "int5"); + if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL)) + pr_err("Couldn't register %s interrupt\n", "int7"); + if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL)) + pr_err("Couldn't register %s interrupt\n", "vec255"); +} -- cgit v1.3.1