[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <184a65a3-6afe-4c82-7f7d-2c1d4a5198bc@amd.com>
Date: Tue, 9 Jan 2018 18:45:34 -0600
From: Tom Lendacky <thomas.lendacky@....com>
To: Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andi Kleen <andi@...stfloor.org>,
the arch/x86 maintainers <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
David Woodhouse <dwmw@...zon.co.uk>,
Paul Turner <pjt@...gle.com>,
Andrew Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...ux-foundation.org>,
Dave Hansen <dave.hansen@...el.com>,
Jiri Kosina <jikos@...nel.org>, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip
On 1/9/2018 6:40 PM, Thomas Gleixner wrote:
> On Tue, 9 Jan 2018, Linus Torvalds wrote:
>
>> On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen <andi@...stfloor.org> wrote:
>>>
>>> The following patch fixes it for me. Something doesn't
>>> seem to work with ALTERNATIVE_2. It adds only a few bytes
>>> more code, so seems acceptable.
>>
>> Ugh. It's kind of stupid, though.
>>
>> Why is the code sequence not simply:
>>
>> ALTERNATIVE "", "lfence", X86_FEATURE_RETPOLINE_AMD
>> ALTERNATIVE __stringify(jmp *\reg), __stringify(RETPOLINE_JMP \reg),
>> X86_FEATURE_RETPOLINE
>>
>> ie make that X86_FEATURE_RETPOLINE_AMD _only_ emit the "lfence", and
>> simply fall through to what will be the "jmp *\reg" of the
>> non-RETPOLINE version.
>>
>> Then just make sure X86_FEATURE_RETPOLINE_AMD disables X86_FEATURE_RETPOLINE.
I think there are areas that rely on X86_FEATURE_RETPOLINE being set
even if X86_FEATURE_RETPOLINE_AMD is set. For example, line 261 in
arch/x86/entry/entry_32.S is only checking for X86_FEATURE_RETPOLINE.
Thanks,
Tom
>>
>> That is both simpler an dsmaller, no?
>
> Duh, yes.
>
Powered by blists - more mailing lists