[RFC PATCH v1 1/2] x86/mm: use VMA lock for kernel faults on user addresses
From: Barry Song (Xiaomi)
Date: Sun Aug 02 2026 - 03:40:39 EST
Use the VMA lock for kernel faults on user addresses. This also
makes the existing code below meaningful:
/* Quick path to respond to signals */
if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
kernelmode_fixup_or_oops(regs, error_code, address,
SIGBUS, BUS_ADRERR,
ARCH_DEFAULT_PKEY);
return;
}
Right now, the code above is dead because !user_mode always
takes the mmap_lock path.
Co-developed-by: Bo Zhang <zhangbo56@xxxxxxxxxx>
Signed-off-by: Bo Zhang <zhangbo56@xxxxxxxxxx>
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
arch/x86/mm/fault.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 45b99c3b1442..c22b74e0eeaf 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1328,9 +1328,6 @@ void do_user_addr_fault(struct pt_regs *regs,
}
#endif
- if (!(flags & FAULT_FLAG_USER))
- goto lock_mmap;
-
vma = lock_vma_under_rcu(mm, address);
if (!vma)
goto lock_mmap;
--
2.39.3 (Apple Git-146)