[RFC PATCH v1 1/2] x86/mm: use VMA lock for kernel faults on user addresses
"Barry Song (Xiaomi)" <[email protected]> Sun, 2 Aug 2026 15:40:17 +0800
| Newsgroups | org.kvack.linux-mm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]>
Signed-off-by: Bo Zhang <[email protected]>
Signed-off-by: Barry Song (Xiaomi) <[email protected]>
---
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)