From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754764AbeAJAjY (ORCPT + 1 other); Tue, 9 Jan 2018 19:39:24 -0500 Received: from mail-io0-f173.google.com ([209.85.223.173]:34629 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754586AbeAJAjU (ORCPT ); Tue, 9 Jan 2018 19:39:20 -0500 X-Google-Smtp-Source: ACJfBosBjz9jTYlaMnUPsWcuFdkgb1VNOx0tROVydoaHl/ViI3FXJ/XV/b1BaMLfz9G9TwpyRCJLEGU1+uaItDuyNXg= MIME-Version: 1.0 In-Reply-To: <20180110003139.10531-1-andi@firstfloor.org> References: <20180110003139.10531-1-andi@firstfloor.org> From: Linus Torvalds Date: Tue, 9 Jan 2018 16:39:19 -0800 X-Google-Sender-Auth: 3lqVMdcTooiHzQ03bDs7mtAkAB0 Message-ID: Subject: Re: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip To: Andi Kleen Cc: Thomas Gleixner , "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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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? Linus