[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251126184820.GB3538@ZenIV>
Date: Wed, 26 Nov 2025 18:48:20 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Xie Yuanbin <xieyuanbin1@...wei.com>
Cc: brauner@...nel.org, jack@...e.cz, linux@...linux.org.uk,
will@...nel.org, nico@...xnic.net, akpm@...ux-foundation.org,
hch@....de, jack@...e.com, wozizhi@...weicloud.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-mm@...ck.org,
lilinjie8@...wei.com, liaohua4@...wei.com,
wangkefeng.wang@...wei.com, pangliyuan1@...wei.com
Subject: Re: [RFC PATCH] vfs: Fix might sleep in load_unaligned_zeropad()
with rcu read lock held
On Wed, Nov 26, 2025 at 06:10:31PM +0000, Al Viro wrote:
> On Wed, Nov 26, 2025 at 06:19:52PM +0800, Xie Yuanbin wrote:
> > When the path is initialized with LOOKUP_RCU flag in path_init(), the
> > rcu read lock will be acquired. Inside the rcu critical section,
> > load_unaligned_zeropad() may be called. According to the comments of
> > load_unaligned_zeropad(), when loading the memory, a page fault may be
> > triggered in the very unlikely case.
>
> > Add pagefault_disable() to handle this situation.
>
> Way too costly, IMO. That needs to be dealt with in page fault handler
> and IIRC arm used to do that; did that get broken at some point?
FWIW, on arm64 it's dealt with hitting do_translation_fault(), which
sees that address is kernel-space one, goes into do_bad_area(), sees
that it's from kernel mode and proceeds into __do_kernel_fault() and
from there - to fixup_exception(). No messing with VMA lookups, etc.
anywhere in process.
Had been that way since 760bfb47c36a "arm64: fault: Route pte translation
faults via do_translation_fault"...
Did that get broken? Or is it actually arm32-specific?
In any case, making every architecture pay for that is insane - taking
a fault there is extremely rare to start with and callers sit on very
hot paths. Deal with that in the fault handler. Really.
We have no business even looking at VMAs when the fault is on kernel-mode
read access to kernel-space address. And callers of load_unaligned_zeropad()
are not the place for dealing with that.
It's been years since I looked at 32bit arm exception handling, so I'd need
quite a bit of (re)RTF{S,M} before I'm comfortable with poking in
arch/arm/mm/fault.c; better let ARM folks deal with that. But arch/* is
where it should be dealt with; as for papering over that in fs/*:
NAKed-by: Al Viro <viro@...iv.linux.org.uk>
Powered by blists - more mailing lists