lkml.org 
[lkml]   [2018]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support
On Fri, Jan 5, 2018 at 2:00 PM, Woodhouse, David <dwmw@amazon.co.uk> wrote:
> +.macro RETPOLINE_JMP reg:req
> + call 1112f
> +1111: lfence
> + jmp 1111b
> +1112: mov %\reg, (%_ASM_SP)
> + ret
> +.endm
> +
> +.macro RETPOLINE_CALL reg:req
> + jmp 1113f
> +1110: RETPOLINE_JMP \reg
> +1113: call 1110b
> +.endm

Why do these still force a register name?

Is it because this is the only user?

> index 2a4b1f09eb84..90d9a1589a54 100644
> --- a/arch/x86/lib/retpoline.S
> +++ b/arch/x86/lib/retpoline.S
> @@ -6,19 +6,14 @@
> #include <asm/cpufeatures.h>
> #include <asm/alternative-asm.h>
> #include <asm/export.h>
> +#include <asm/nospec-branch.h>
>
> -.macro THUNK sp reg
> +.macro THUNK reg
> .section .text.__x86.indirect_thunk.\reg
>
> ENTRY(__x86.indirect_thunk.\reg)
> CFI_STARTPROC
> - ALTERNATIVE_2 "call 2f", __stringify(lfence;jmp *%\reg), X86_FEATURE_K8, __stringify(jmp *%\reg), X86_FEATURE_NO_RETPOLINE
> -1:
> - lfence
> - jmp 1b
> -2:
> - mov %\reg, (%\sp)
> - ret
> + NOSPEC_JMP \reg
> CFI_ENDPROC

Can we just move those macros into retpoline.S because using them
outside that shouldn't happen?

Linus

\
 
 \ /
  Last update: 2018-01-06 00:50    [W:0.423 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site