Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754897AbeAJAk3 (ORCPT + 1 other); Tue, 9 Jan 2018 19:40:29 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:53818 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754667AbeAJAk1 (ORCPT ); Tue, 9 Jan 2018 19:40:27 -0500 Date: Wed, 10 Jan 2018 01:40:25 +0100 (CET) From: Thomas Gleixner To: Linus Torvalds cc: Andi Kleen , the arch/x86 maintainers , Linux Kernel Mailing List , David Woodhouse , Paul Turner , Andrew Lutomirski , Peter Zijlstra , Tom Lendacky , Tim Chen , Greg Kroah-Hartman , Dave Hansen , Jiri Kosina , Andi Kleen Subject: Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip In-Reply-To: Message-ID: References: <20180110003139.10531-1-andi@firstfloor.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 9 Jan 2018, Linus Torvalds wrote: > On Tue, Jan 9, 2018 at 4:31 PM, Andi Kleen 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. > > That is both simpler an dsmaller, no? Duh, yes.