From 0ca5e3dd1ad006a5251a391676e90ec4dc94df20 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 19 Apr 2025 22:41:07 +0000 Subject: [PATCH] riscv: Fix handling of interrupts during kernel page faults We were checking the wrong status bit when deciding whether to enable interrupts. Reviewed by: jrtc27 Fixes: c226f193515c ("riscv: Permit spurious faults in kernel mode") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D49897 --- sys/riscv/riscv/trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index a1a30eb5822..d6df1245a24 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -239,7 +239,7 @@ page_fault_handler(struct trapframe *frame, int usermode) * Enable interrupts for the duration of the page fault. For * user faults this was done already in do_trap_user(). */ - if ((frame->tf_sstatus & SSTATUS_SIE) != 0) + if ((frame->tf_sstatus & SSTATUS_SPIE) != 0) intr_enable(); if (stval >= VM_MIN_KERNEL_ADDRESS) {