Re: [PATCH 4/7] x86,nospec: Annotate indirect calls/jumps

From: David Woodhouse
Date: Thu Feb 01 2018 - 09:55:41 EST




On Thu, 2018-02-01 at 15:34 +0100, Peter Zijlstra wrote:
>
> Â * These are the bare retpoline primitives for indirect jmp and call.
> Â * Do not use these directly; they only exist to make the ALTERNATIVE
> Â * invocation below less ugly.
> @@ -102,9 +114,9 @@
> Â.macro JMP_NOSPEC reg:req
> Â#ifdef CONFIG_RETPOLINE
> ÂÂÂÂÂÂÂÂANNOTATE_NOSPEC_ALTERNATIVE
> -ÂÂÂÂÂÂÂALTERNATIVE_2 __stringify(jmp *\reg),ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ\
> +ÂÂÂÂÂÂÂALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *\reg),ÂÂ\
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__stringify(RETPOLINE_JMP \reg), X86_FEATURE_RETPOLINE,Â\
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__stringify(lfence; jmp *\reg), X86_FEATURE_RETPOLINE_AMD
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *\reg), X86_FEATURE_RETPOLINE_AMD
> Â#else
> ÂÂÂÂÂÂÂÂjmpÂÂÂÂÂ*\reg
> Â#endif

The first one, yes. But the second one for the AMD retpoline is
redundant, isn't it? Objtool isn't going to look there.

Attachment: smime.p7s
Description: S/MIME cryptographic signature