Messages in this thread | | | Date | Tue, 7 Apr 2020 15:59:53 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH V2 9/9] x86/speculation: Remove all ANNOTATE_NOSPEC_ALTERNATIVE directives |
| |
On Tue, Apr 07, 2020 at 03:52:11PM +0200, Peter Zijlstra wrote: > On Tue, Apr 07, 2020 at 09:31:42AM +0200, Alexandre Chartre wrote: > > > - ANNOTATE_NOSPEC_ALTERNATIVE > > ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *\reg), \ > > __stringify(RETPOLINE_JMP \reg), X86_FEATURE_RETPOLINE, \ > > __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *\reg), X86_FEATURE_RETPOLINE_AMD > > Possibly we can write this like:
.macro OOL_RETPOLINE_JMP reg:req SYM_FUNC_START(__x86_retpoline_jmp_\reg) CFI_STARTPROC RETPOLINE_JMP \reg CFI_ENDPROC SYM_FUNC_END(__x86_retpoline_jmp_\reg) .endm
> ALTERNATIVE("", "lfence", X86_FEATURE_RETPOLINE_AMD); > ALTERNATIVE("jmp *\reg", "jmp __x86_retpoline_jmp_\reg", X86_FEATURE_RETPOLINE); > > With an out-of-line copy of the retpoline, just like the THUNKs the > compiler uses, except of course, it can't be those, because we actually > want to use the alternative to implement those. > > By moving the retpoline magic out-of-line we ensure it has a unique > address and the ORC stuff should work. > > I'm just not sure what to do about the RETPOLINE_CALL variant.
Duh, something like so:
ALTERNATIVE("", "lfence", X86_FEATURE_RETPOLINE_AMD); ALTERNATIVE("call *\reg", "call __x86_retpoline_jmp_\reg", X86_FEATURE_RETPOLINE);
| |