Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Tom Lendacky
On 1/6/2018 3:21 PM, Woodhouse, David wrote: > On Sat, 2018-01-06 at 21:16 +, Andrew Cooper wrote: >> On 06/01/18 11:49, David Woodhouse wrote: >>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >>> index 372ba3f..40e6e54 100644 >>> --- a/arch/x86/kernel/cpu/common.c

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Tom Lendacky
On 1/6/2018 3:21 PM, Woodhouse, David wrote: > On Sat, 2018-01-06 at 21:16 +, Andrew Cooper wrote: >> On 06/01/18 11:49, David Woodhouse wrote: >>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >>> index 372ba3f..40e6e54 100644 >>> --- a/arch/x86/kernel/cpu/common.c

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Woodhouse, David
On Sat, 2018-01-06 at 21:34 +, Andrew Cooper wrote: > On 06/01/18 21:23, Thomas Gleixner wrote: > > > > On Sat, 6 Jan 2018, Andrew Cooper wrote: > > > > > > On 06/01/18 11:49, David Woodhouse wrote: > > > > > > > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > >

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Woodhouse, David
On Sat, 2018-01-06 at 21:34 +, Andrew Cooper wrote: > On 06/01/18 21:23, Thomas Gleixner wrote: > > > > On Sat, 6 Jan 2018, Andrew Cooper wrote: > > > > > > On 06/01/18 11:49, David Woodhouse wrote: > > > > > > > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > >

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Andrew Cooper
On 06/01/18 21:23, Thomas Gleixner wrote: > On Sat, 6 Jan 2018, Andrew Cooper wrote: >> On 06/01/18 11:49, David Woodhouse wrote: >>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >>> index 372ba3f..40e6e54 100644 >>> --- a/arch/x86/kernel/cpu/common.c >>> +++

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Andrew Cooper
On 06/01/18 21:23, Thomas Gleixner wrote: > On Sat, 6 Jan 2018, Andrew Cooper wrote: >> On 06/01/18 11:49, David Woodhouse wrote: >>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >>> index 372ba3f..40e6e54 100644 >>> --- a/arch/x86/kernel/cpu/common.c >>> +++

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Thomas Gleixner
On Sat, 6 Jan 2018, Andrew Cooper wrote: > On 06/01/18 11:49, David Woodhouse wrote: > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 372ba3f..40e6e54 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@ -904,6 +904,11 @@

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Thomas Gleixner
On Sat, 6 Jan 2018, Andrew Cooper wrote: > On 06/01/18 11:49, David Woodhouse wrote: > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 372ba3f..40e6e54 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@ -904,6 +904,11 @@

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Woodhouse, David
On Sat, 2018-01-06 at 21:16 +, Andrew Cooper wrote: > On 06/01/18 11:49, David Woodhouse wrote: > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 372ba3f..40e6e54 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Woodhouse, David
On Sat, 2018-01-06 at 21:16 +, Andrew Cooper wrote: > On 06/01/18 11:49, David Woodhouse wrote: > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 372ba3f..40e6e54 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Andrew Cooper
On 06/01/18 11:49, David Woodhouse wrote: > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 372ba3f..40e6e54 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -904,6 +904,11 @@ static void __init early_identify_cpu(struct

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Andrew Cooper
On 06/01/18 11:49, David Woodhouse wrote: > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 372ba3f..40e6e54 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -904,6 +904,11 @@ static void __init early_identify_cpu(struct

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
On Sat, 2018-01-06 at 10:35 -0800, Eric Biggers wrote: > On Sat, Jan 06, 2018 at 11:49:24AM +, David Woodhouse wrote: > > > > +/* > > + * NOSPEC_JMP and NOSPEC_CALL macros can be used instead of a simple > > + * indirect jmp/call which may be susceptible to the Spectre variant 2 > > + *

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
On Sat, 2018-01-06 at 10:35 -0800, Eric Biggers wrote: > On Sat, Jan 06, 2018 at 11:49:24AM +, David Woodhouse wrote: > > > > +/* > > + * NOSPEC_JMP and NOSPEC_CALL macros can be used instead of a simple > > + * indirect jmp/call which may be susceptible to the Spectre variant 2 > > + *

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Eric Biggers
On Sat, Jan 06, 2018 at 11:49:24AM +, David Woodhouse wrote: > +/* > + * NOSPEC_JMP and NOSPEC_CALL macros can be used instead of a simple > + * indirect jmp/call which may be susceptible to the Spectre variant 2 > + * attack. > + */ Can be, or must be? > +.macro NOSPEC_JMP reg:req > +#ifdef

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread Eric Biggers
On Sat, Jan 06, 2018 at 11:49:24AM +, David Woodhouse wrote: > +/* > + * NOSPEC_JMP and NOSPEC_CALL macros can be used instead of a simple > + * indirect jmp/call which may be susceptible to the Spectre variant 2 > + * attack. > + */ Can be, or must be? > +.macro NOSPEC_JMP reg:req > +#ifdef

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
On Sat, 2018-01-06 at 11:49 +, David Woodhouse wrote: > > +#if defined(CONFIG_X86_64) && defined(RETPOLINE) > +/* > + * Since the inline asm uses the %V modifier which is only in newer GCC, > + * the 64-bit one is dependent on RETPOLINE not CONFIG_RETPOLINE. > + */ > +# define NOSPEC_CALL

Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
On Sat, 2018-01-06 at 11:49 +, David Woodhouse wrote: > > +#if defined(CONFIG_X86_64) && defined(RETPOLINE) > +/* > + * Since the inline asm uses the %V modifier which is only in newer GCC, > + * the 64-bit one is dependent on RETPOLINE not CONFIG_RETPOLINE. > + */ > +# define NOSPEC_CALL

[PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
Enable the use of -mindirect-branch=thunk-extern in newer GCC, and provide the corresponding thunks. Provide assembler macros for invoking the thunks in the same way that GCC does, from native and inline assembler. This adds X86_FEATURE_RETPOLINE and sets it by default on all CPUs. In some

[PATCH v5 02/12] x86/retpoline: Add initial retpoline support

2018-01-06 Thread David Woodhouse
Enable the use of -mindirect-branch=thunk-extern in newer GCC, and provide the corresponding thunks. Provide assembler macros for invoking the thunks in the same way that GCC does, from native and inline assembler. This adds X86_FEATURE_RETPOLINE and sets it by default on all CPUs. In some