[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180106183541.GA8258@zzz.localdomain>
Date: Sat, 6 Jan 2018 10:35:41 -0800
From: Eric Biggers <ebiggers3@...il.com>
To: David Woodhouse <dwmw@...zon.co.uk>
Cc: Andi Kleen <ak@...ux.intel.com>, Paul Turner <pjt@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>, tglx@...utronix.de,
Kees Cook <keescook@...gle.com>,
Rik van Riel <riel@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...capital.net>,
Jiri Kosina <jikos@...nel.org>, gnomes@...rguk.ukuu.org.uk
Subject: Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support
On Sat, Jan 06, 2018 at 11:49:24AM +0000, David Woodhouse wrote:
> +/*
> + * NOSPEC_JMP and NOSPEC_CALL macros can be used instead of a simple
> + * indirect jmp/call which may be susceptible to the Spectre variant 2
> + * attack.
> + */
Can be, or must be?
> +.macro NOSPEC_JMP reg:req
> +#ifdef CONFIG_RETPOLINE
> + ALTERNATIVE_2 __stringify(jmp *\reg), \
> + __stringify(RETPOLINE_JMP \reg), X86_FEATURE_RETPOLINE, \
> + __stringify(lfence; jmp *\reg), X86_FEATURE_RETPOLINE_AMD
> +#else
> + jmp *\reg
> +#endif
> +.endm
> +
> +.macro NOSPEC_CALL reg:req
> +#ifdef CONFIG_RETPOLINE
> + ALTERNATIVE_2 __stringify(call *\reg), \
> + __stringify(RETPOLINE_CALL \reg), X86_FEATURE_RETPOLINE,\
> + __stringify(lfence; call *\reg), X86_FEATURE_RETPOLINE_AMD
> +#else
> + call *\reg
> +#endif
> +.endm
Would it make any sense to name these INDIRECT_JMP and INDIRECT_CALL instead?
NOSPEC_ seems to describe how it needs to be implemented on some CPUs, as
opposed to what the user wants to do (make an indirect jump or call).
Eric
Powered by blists - more mailing lists