[PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

David Laight David.Laight at ACULAB.COM
Mon Oct 14 20:59:09 AEDT 2024


...
> > If I understand correctly, LAM bits are for the benefit of SW and are
> > ignored by HW?  Can we just mask those bits off?
> 
> Yes. But then you waste time on the masking, but particularly if it
> then causes silly extra overhead just to get the mask.

Isn't LAM just plain stupid unless the hardware validates the bits
against the TLB?
You start with a nice big sparse address space (potentially 63 bits of it)
where things can be spread out to make 'random' addresses likely to
fault and then alias 32k addresses onto each memory location.
Sounds brain-dead to me.
If you could set the stack pointer to a 'high' address and have the
hardware check that the TLB was for that alias then you'd get
reasonable stack overflow checking.

...
> namely bit #63, not some random meaningless bit that just happens to
> be one of the bits that is then checked for canonicality.
> 
> And it's so annoying, because from a *hardware* perspective, bit #63
> vs bit #48 is completely irrelevant. It's literally just a wire choice
> 
> But from an architectural perspective, bit #63 is not only the
> *actual* bit that is the real difference  ("kernel is at the top of
> the address space") but for software, bit #48 is fundamentally harder
> to test.

Doesn't ARM64 have the same issue?

I'm sure I also remember some other architectural feature that
extends the valid virtual addresses beyond 48 bits?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


More information about the Linuxppc-dev mailing list