[RFC PATCH v2 1/2] ARM/mm/fault: always goto bad_area when handling with page faults of kernel address
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Fri Nov 28 04:03:59 PST 2025
On 2025-11-28 10:27:56 [+0800], Xie Yuanbin wrote:
> According to the discussion, it might be better to handle the kernel
> address fault directly, just like what x86 does, instead of finding VMA.
the kernel fault shouldn't have a VMA
> Link: https://elixir.bootlin.com/linux/v6.18-rc7/source/arch/x86/mm/fault.c#L1473
> ```c
> if (unlikely(fault_in_kernel_space(address)))
> do_kern_addr_fault(regs, error_code, address);
> else
> do_user_addr_fault(regs, error_code, address);
> ```
>
> It seems your patches hasn't been merged into the linux-next branch yet.
I hope Russell will add them once he gets to it. They got reviewed, I
added them to the patch system.
> This patch is based on linux-next, so it doesn't include your
> modifications. This patch might conflict with your patch:
> Link: https://lore.kernel.org/20251110145555.2555055-2-bigeasy@linutronix.de
> so I'd like to discuss it with you.
what about this:
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index ad58c1e22a5f9..b6b3cd893c808 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -282,10 +282,10 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
}
/*
- * If we're in an interrupt or have no user
- * context, we must not take the fault..
+ * If we're in an interrupt or have no user context, we must not take
+ * the fault. Kernel addresses are handled in do_translation_fault().
*/
- if (faulthandler_disabled() || !mm)
+ if (faulthandler_disabled() || !mm || addr >= TASK_SIZE)
goto no_context;
if (user_mode(regs))
We shouldn't be getting here. Above TASK_SIZE there are just fix
mappings which don't fault and the VMALLOC array which should be handled
by do_translation_fault(). So this should be only the exception table.
This should also not clash with the previous patches. Would that work
for everyone?
> Thanks!
>
> Xie Yuanbin
Sebastian
More information about the linux-arm-kernel
mailing list