2022-04-20 15:32:56

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 1/2] x86: Simplify Retpoline thunk

Now that we rewrite all the indirect call sites, per commit:

750850090081 ("x86/alternative: Implement .retpoline_sites support")

it doesn't make sense to have the retpoline thunks be an ALTERNATIVE_2
that still includes a 'naked' indirect jump.

(this accidentally 'defunnels' i386 by going back to full retpolines)

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
arch/x86/lib/retpoline.S | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/x86/lib/retpoline.S
+++ b/arch/x86/lib/retpoline.S
@@ -32,9 +32,9 @@
SYM_INNER_LABEL(__x86_indirect_thunk_\reg, SYM_L_GLOBAL)
UNWIND_HINT_EMPTY

- ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \
- __stringify(RETPOLINE \reg), X86_FEATURE_RETPOLINE, \
- __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg; int3), X86_FEATURE_RETPOLINE_LFENCE
+ ALTERNATIVE __stringify(RETPOLINE \reg), \
+ __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg; int3), \
+ X86_FEATURE_RETPOLINE_LFENCE

.endm




2022-04-21 05:25:27

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Simplify Retpoline thunk

On Tue, Apr 19, 2022 at 10:41:10PM +0200, Peter Zijlstra wrote:
> Now that we rewrite all the indirect call sites, per commit:
>
> 750850090081 ("x86/alternative: Implement .retpoline_sites support")
>
> it doesn't make sense to have the retpoline thunks be an ALTERNATIVE_2
> that still includes a 'naked' indirect jump.
>
> (this accidentally 'defunnels' i386 by going back to full retpolines)

So mitigations=off no longer works on i386?

Is funneling even a concern on i386? I don't think it has eIBRS anyway,
or does it?

--
Josh

2022-04-21 14:04:21

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Simplify Retpoline thunk

On Wed, Apr 20, 2022 at 08:27:36AM -0700, Josh Poimboeuf wrote:
> On Tue, Apr 19, 2022 at 10:41:10PM +0200, Peter Zijlstra wrote:
> > Now that we rewrite all the indirect call sites, per commit:
> >
> > 750850090081 ("x86/alternative: Implement .retpoline_sites support")
> >
> > it doesn't make sense to have the retpoline thunks be an ALTERNATIVE_2
> > that still includes a 'naked' indirect jump.
> >
> > (this accidentally 'defunnels' i386 by going back to full retpolines)
>
> So mitigations=off no longer works on i386?

Also true I suppose... does anybody care? /me runs like heck.

I'd hate to make all this more complicated just because i386 tho :/

2022-04-22 04:16:48

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH 1/2] x86: Simplify Retpoline thunk

On Wed, Apr 20, 2022 at 05:51:16PM +0200, Peter Zijlstra wrote:
> On Wed, Apr 20, 2022 at 08:27:36AM -0700, Josh Poimboeuf wrote:
> > On Tue, Apr 19, 2022 at 10:41:10PM +0200, Peter Zijlstra wrote:
> > > Now that we rewrite all the indirect call sites, per commit:
> > >
> > > 750850090081 ("x86/alternative: Implement .retpoline_sites support")
> > >
> > > it doesn't make sense to have the retpoline thunks be an ALTERNATIVE_2
> > > that still includes a 'naked' indirect jump.
> > >
> > > (this accidentally 'defunnels' i386 by going back to full retpolines)
> >
> > So mitigations=off no longer works on i386?
>
> Also true I suppose... does anybody care? /me runs like heck.
>
> I'd hate to make all this more complicated just because i386 tho :/

Not that I care... but at least the commit log should own up to it :-)

--
Josh