[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251128120359.Xc09qn1W@linutronix.de>
Date: Fri, 28 Nov 2025 13:03:59 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Xie Yuanbin <xieyuanbin1@...wei.com>
Cc: akpm@...ux-foundation.org, arnd@...db.de, brauner@...nel.org,
david.laight@...box.com, hch@....de, jack@...e.com,
kuninori.morimoto.gx@...esas.com, liaohua4@...wei.com,
lilinjie8@...wei.com, linux-arm-kernel@...ts.infradead.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux@...linux.org.uk,
lorenzo.stoakes@...cle.com, marc.zyngier@....com, nico@...xnic.net,
pangliyuan1@...wei.com, pfalcato@...e.de, punitagrawal@...il.com,
rjw@...ysocki.net, rmk+kernel@...linux.org.uk, rppt@...nel.org,
tony@...mide.com, vbabka@...e.cz, viro@...iv.linux.org.uk,
wangkefeng.wang@...wei.com, will@...nel.org,
wozizhi@...weicloud.com
Subject: Re: [RFC PATCH v2 1/2] ARM/mm/fault: always goto bad_area when
handling with page faults of kernel address
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
Powered by blists - more mailing lists