[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251106134255.2412971a@pumpkin>
Date: Thu, 6 Nov 2025 13:42:55 +0000
From: David Laight <david.laight.linux@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>, Alexander Viro
<viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara
<jack@...e.cz>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
<mingo@...hat.com>, Darren Hart <dvhart@...radead.org>, Davidlohr Bueso
<dave@...olabs.net>, Andre Almeida <andrealmeid@...lia.com>, Andrew Morton
<akpm@...ux-foundation.org>, Eric Dumazet <edumazet@...gle.com>, Kuniyuki
Iwashima <kuniyu@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Willem de
Bruijn <willemb@...gle.com>, "David S. Miller" <davem@...emloft.net>, Jakub
Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>, Daniel
Borkmann <daniel@...earbox.net>, Dave Hansen <dave.hansen@...ux.intel.com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>, Michael Ellerman
<mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v4 10/10] powerpc/uaccess: Implement masked user access
On Thu, 6 Nov 2025 13:35:50 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> On Thu, Nov 06, 2025 at 12:31:28PM +0100, Christophe Leroy wrote:
>
> > On 32 bits it is more tricky. In theory user space can go up to
> > 0xbfffffff while kernel will usually start at 0xc0000000. So a gap
> > needs to be added in-between. Allthough in theory a single 4k page
Although
> > would suffice, it is easier and more efficient to enforce a 128k gap
> > below kernel, as it simplifies the masking.
>
> Do we have the requirement that the first access of a masked pointer is
> within 4k of the initial address?
>
> Suppose the pointer is to an 16k array, and the memcpy happens to like
> going backwards. Then a 4k hole just won't do.
I think that requiring the accesses be within 4k of the base (or previous
access) is a reasonable restriction.
It is something that needs verifying before code is changed to use
these accessors.
Documenting a big gap is almost more likely to lead to errors!
If 128k is ok, no one is really going to notice code that might
offset by 130k.
OTOH if the (documented) limit is 256 bytes then you don't have to be
careful about accessing structures sequentially, and can safely realign
pointers.
I suspect the mk-1 brain treats 4k and 256 as muchthe same value.
Requiring fully sequential accesses (which the original x86-64 required
because it converted kernel addresses to ~0) would require policing by
the compiler - I tried it once, it horrid.
David
Powered by blists - more mailing lists