Thread (18 messages) 18 messages, 6 authors, 2025-11-17

Re: [PATCH v4 10/10] powerpc/uaccess: Implement masked user access

From: David Laight <hidden>
Date: 2025-11-06 13:43:02
Also in: linux-block, linux-fsdevel, linuxppc-dev, lkml

On Thu, 6 Nov 2025 13:35:50 +0100
Peter Zijlstra [off-list ref] wrote:
On Thu, Nov 06, 2025 at 12:31:28PM +0100, Christophe Leroy wrote:
quoted
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
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help