Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-10 Thread David Woodhouse
On Wed, 2018-01-10 at 07:15 +, David Woodhouse wrote: > I'd really like to know what went wrong though. Did we merge Borislav's > attempt to peek at jumps inside alternatives, perchance? Will take a > look... Ah, it only happens if I run in KVM, not with Qemu's CPU; that's why it didn't show

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-10 Thread David Woodhouse
On Wed, 2018-01-10 at 07:15 +, David Woodhouse wrote: > I'd really like to know what went wrong though. Did we merge Borislav's > attempt to peek at jumps inside alternatives, perchance? Will take a > look... Ah, it only happens if I run in KVM, not with Qemu's CPU; that's why it didn't show

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-10 Thread David Woodhouse
On Tue, 2018-01-09 at 17:30 -0800, Andi Kleen wrote: > I assume you don't need FILL_RETURN_BUFFER on AMD. If not let me know > and we can add a X86_FEATURE_RETPOLINE_COMMON FWIW the AMD doc I have here (Tom, is that public now?) does say we should fill the RSB. That's a minor tweak

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-10 Thread David Woodhouse
On Tue, 2018-01-09 at 17:30 -0800, Andi Kleen wrote: > I assume you don't need FILL_RETURN_BUFFER on AMD. If not let me know > and we can add a X86_FEATURE_RETPOLINE_COMMON FWIW the AMD doc I have here (Tom, is that public now?) does say we should fill the RSB. That's a minor tweak

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread David Woodhouse
On Tue, 2018-01-09 at 16:39 -0800, Linus Torvalds wrote: > On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen > wrote: > > > > > > The following patch fixes it for me. Something doesn't > > seem to work with ALTERNATIVE_2. It adds only a few bytes > > more code, so seems

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread David Woodhouse
On Tue, 2018-01-09 at 16:39 -0800, Linus Torvalds wrote: > On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen > wrote: > > > > > > The following patch fixes it for me. Something doesn't > > seem to work with ALTERNATIVE_2. It adds only a few bytes > > more code, so seems acceptable. > Ugh. It's kind of

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
On Wed, Jan 10, 2018 at 02:50:12AM +0100, Thomas Gleixner wrote: > On Tue, 9 Jan 2018, Andi Kleen wrote: > > > > > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > > > arch/x86/entry/entry_32.S is

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
On Wed, Jan 10, 2018 at 02:50:12AM +0100, Thomas Gleixner wrote: > On Tue, 9 Jan 2018, Andi Kleen wrote: > > > > > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > > > arch/x86/entry/entry_32.S is

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > > > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > > arch/x86/entry/entry_32.S is only checking for X86_FEATURE_RETPOLINE. > > > > I audited the difference

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > > > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > > arch/x86/entry/entry_32.S is only checking for X86_FEATURE_RETPOLINE. > > > > I audited the difference

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
> > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > arch/x86/entry/entry_32.S is only checking for X86_FEATURE_RETPOLINE. > > I audited the difference places. They all seem ok. Actually 32bit is not

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
> > I think there are areas that rely on X86_FEATURE_RETPOLINE being set > > even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in > > arch/x86/entry/entry_32.S is only checking for X86_FEATURE_RETPOLINE. > > I audited the difference places. They all seem ok. Actually 32bit is not

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
On Tue, Jan 09, 2018 at 06:45:34PM -0600, Tom Lendacky wrote: > On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > > On Tue, 9 Jan 2018, Linus Torvalds wrote: > > > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > >>> > >>> The following patch fixes it for me. Something

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
On Tue, Jan 09, 2018 at 06:45:34PM -0600, Tom Lendacky wrote: > On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > > On Tue, 9 Jan 2018, Linus Torvalds wrote: > > > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > >>> > >>> The following patch fixes it for me. Something doesn't > >>> seem to

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > > Then just make sure X86_FEATURE_RETPOLINE_AMD disables > > X86_FEATURE_RETPOLINE. > > > > That is both simpler an dsmaller, no? > > Yes that works, and is clearly better/simpler. > > Tested-by: Andi Kleen > > Thomas, I assume

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > > Then just make sure X86_FEATURE_RETPOLINE_AMD disables > > X86_FEATURE_RETPOLINE. > > > > That is both simpler an dsmaller, no? > > Yes that works, and is clearly better/simpler. > > Tested-by: Andi Kleen > > Thomas, I assume you will fix it up, or

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
> Then just make sure X86_FEATURE_RETPOLINE_AMD disables X86_FEATURE_RETPOLINE. > > That is both simpler an dsmaller, no? Yes that works, and is clearly better/simpler. Tested-by: Andi Kleen Thomas, I assume you will fix it up, or let me know if I should send another

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
> Then just make sure X86_FEATURE_RETPOLINE_AMD disables X86_FEATURE_RETPOLINE. > > That is both simpler an dsmaller, no? Yes that works, and is clearly better/simpler. Tested-by: Andi Kleen Thomas, I assume you will fix it up, or let me know if I should send another patch. -Andi

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Tom Lendacky wrote: > On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > > On Tue, 9 Jan 2018, Linus Torvalds wrote: > > > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > >>> > >>> The following patch fixes it for me. Something doesn't > >>> seem to

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Tom Lendacky wrote: > On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > > On Tue, 9 Jan 2018, Linus Torvalds wrote: > > > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > >>> > >>> The following patch fixes it for me. Something doesn't > >>> seem to work with ALTERNATIVE_2.

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Tom Lendacky
On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > On Tue, 9 Jan 2018, Linus Torvalds wrote: > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: >>> >>> The following patch fixes it for me. Something doesn't >>> seem to work with ALTERNATIVE_2. It adds only a few bytes >>>

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Tom Lendacky
On 1/9/2018 6:40 PM, Thomas Gleixner wrote: > On Tue, 9 Jan 2018, Linus Torvalds wrote: > >> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: >>> >>> The following patch fixes it for me. Something doesn't >>> seem to work with ALTERNATIVE_2. It adds only a few bytes >>> more code, so seems

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Linus Torvalds wrote: > On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > > > > The following patch fixes it for me. Something doesn't > > seem to work with ALTERNATIVE_2. It adds only a few bytes > > more code, so seems acceptable. > > Ugh. It's kind

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Linus Torvalds wrote: > On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > > > > The following patch fixes it for me. Something doesn't > > seem to work with ALTERNATIVE_2. It adds only a few bytes > > more code, so seems acceptable. > > Ugh. It's kind of stupid, though. >

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Linus Torvalds
On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > > The following patch fixes it for me. Something doesn't > seem to work with ALTERNATIVE_2. It adds only a few bytes > more code, so seems acceptable. Ugh. It's kind of stupid, though. Why is the code sequence not simply:

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Linus Torvalds
On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen wrote: > > The following patch fixes it for me. Something doesn't > seem to work with ALTERNATIVE_2. It adds only a few bytes > more code, so seems acceptable. Ugh. It's kind of stupid, though. Why is the code sequence not simply: ALTERNATIVE "",

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > From: Andi Kleen > > With the latest tip x86/pti I get oopses when booting > a 64bit VM in qemu with RETPOLINE/gcc7 and PTI enabled. > > The following patch fixes it for me. Something doesn't > seem to work with ALTERNATIVE_2. It

Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Thomas Gleixner
On Tue, 9 Jan 2018, Andi Kleen wrote: > From: Andi Kleen > > With the latest tip x86/pti I get oopses when booting > a 64bit VM in qemu with RETPOLINE/gcc7 and PTI enabled. > > The following patch fixes it for me. Something doesn't > seem to work with ALTERNATIVE_2. It adds only a few bytes >

[PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
From: Andi Kleen With the latest tip x86/pti I get oopses when booting a 64bit VM in qemu with RETPOLINE/gcc7 and PTI enabled. The following patch fixes it for me. Something doesn't seem to work with ALTERNATIVE_2. It adds only a few bytes more code, so seems acceptable.

[PATCH] x86/retpoline: Fix NOSPEC_JMP for tip

2018-01-09 Thread Andi Kleen
From: Andi Kleen With the latest tip x86/pti I get oopses when booting a 64bit VM in qemu with RETPOLINE/gcc7 and PTI enabled. The following patch fixes it for me. Something doesn't seem to work with ALTERNATIVE_2. It adds only a few bytes more code, so seems acceptable. Signed-off-by: Andi