Re: [PATCH v2 0/6] x86/uaccess: Avoid barrier_nospec()

2024-10-17 Thread Andrew Cooper
On 17/10/2024 10:55 pm, Josh Poimboeuf wrote: > At least for now, continue to assume mask_user_address() is safe on AMD > when combined with STAC/CLAC -- as get_user(), put_user() and > masked_user_access_begin() already do today. Honestly, I find this a very worrying position to take. It's one t

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

2024-10-16 Thread Andrew Cooper
On 16/10/2024 5:10 pm, Linus Torvalds wrote: > --- a/arch/x86/lib/getuser.S > +++ b/arch/x86/lib/getuser.S > @@ -37,11 +37,14 @@ > >#define ASM_BARRIER_NOSPEC ALTERNATIVE "", "lfence", > X86_FEATURE_LFENCE_RDTSC > > +#define X86_CANONICAL_MASK ALTERNATIVE \ > + "movq $0x80007

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

2024-10-14 Thread Andrew Cooper
On 14/10/2024 1:30 pm, Kirill A. Shutemov wrote: > On Sun, Oct 13, 2024 at 11:50:55PM -0700, Linus Torvalds wrote: >> Anyway, the attached patch >> >> diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S >> index d066aecf8aeb..7d5730aa18b8 100644 >> --- a/arch/x86/lib/getuser.S >> +++ b/arc

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

2024-10-14 Thread Andrew Cooper
On 14/10/2024 7:50 am, Linus Torvalds wrote: > On Sun, 13 Oct 2024 at 20:54, Josh Poimboeuf wrote: >> If I understand correctly, LAM bits are for the benefit of SW and are >> ignored by HW? That is what is written in the ISE today. But, I'll note that on ARM, MTE (Memory Tagging Extensions) use

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

2024-10-12 Thread Andrew Cooper
On 12/10/2024 4:44 pm, Linus Torvalds wrote: > On Sat, 12 Oct 2024 at 01:49, Andrew Cooper wrote: >> You do realise mask_user_address() is unsafe under speculation on AMD >> systems? > That had *better* not be true. Yeah I'd prefer it wasn't true either. >> Had

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

2024-10-12 Thread Andrew Cooper
On 12/10/2024 3:09 pm, Josh Poimboeuf wrote: > On Sat, Oct 12, 2024 at 09:48:57AM +0100, Andrew Cooper wrote: >> On 12/10/2024 5:09 am, Josh Poimboeuf wrote: >>> For x86-64, the barrier_nospec() in copy_from_user() is overkill and >>> painfully slow. Instead, use pointe

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

2024-10-12 Thread Andrew Cooper
On 12/10/2024 5:09 am, Josh Poimboeuf wrote: > For x86-64, the barrier_nospec() in copy_from_user() is overkill and > painfully slow. Instead, use pointer masking to force the user pointer > to a non-kernel value even in speculative paths. > > Signed-off-by: Josh Poimboeuf You do realise mask_us

Re: [Xen-devel] [PATCH 0/8] Use correctly the Xen memory terminologies in Linux

2015-07-28 Thread Andrew Cooper
On 28/07/15 22:06, H. Peter Anvin wrote: > On 07/28/2015 08:02 AM, Julien Grall wrote: >> Hi all, >> >> This patch series aims to use the memory terminologies described in >> include/linux/mm.h [1] for Linux xen code. >> >> Linux is using mistakenly MFN when GFN is meant, I suspect this is because