[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyiQw2mr33+wgh__3ur4vQrs31L8ec4HHrzq7vnKTwXAw@mail.gmail.com>
Date: Fri, 5 Jan 2018 15:50:30 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Woodhouse, David" <dwmw@...zon.co.uk>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"tim.c.chen@...ux.intel.com" <tim.c.chen@...ux.intel.com>,
"bp@...e.de" <bp@...e.de>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"riel@...hat.com" <riel@...hat.com>,
"keescook@...gle.com" <keescook@...gle.com>,
"gnomes@...rguk.ukuu.org.uk" <gnomes@...rguk.ukuu.org.uk>,
"pjt@...gle.com" <pjt@...gle.com>,
"dave.hansen@...el.com" <dave.hansen@...el.com>,
"luto@...capital.net" <luto@...capital.net>,
"jikos@...nel.org" <jikos@...nel.org>,
"gregkh@...ux-foundation.org" <gregkh@...ux-foundation.org>
Subject: Re: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support
On Fri, Jan 5, 2018 at 2:00 PM, Woodhouse, David <dwmw@...zon.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
Powered by blists - more mailing lists