From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444AbeAJAbw (ORCPT + 1 other); Tue, 9 Jan 2018 19:31:52 -0500 Received: from mga09.intel.com ([134.134.136.24]:44280 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754212AbeAJAbv (ORCPT ); Tue, 9 Jan 2018 19:31:51 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,337,1511856000"; d="scan'208";a="165507019" From: Andi Kleen To: tglx@linutronix.de Cc: x86@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, dwmw@amazon.co.uk, pjt@google.com, luto@kernel.org, peterz@infradead.org, thomas.lendacky@amd.com, tim.c.chen@linux.intel.com, gregkh@linux-foundation.org, dave.hansen@intel.com, jikos@kernel.org, Andi Kleen Subject: [PATCH] x86/retpoline: Fix NOSPEC_JMP for tip Date: Tue, 9 Jan 2018 16:31:39 -0800 Message-Id: <20180110003139.10531-1-andi@firstfloor.org> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Andi Kleen With the latest tip x86/pti I get oopses when booting a 64bit VM in qemu with RETPOLINE/gcc7 and PTI enabled. 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. Signed-off-by: Andi Kleen --- arch/x86/include/asm/nospec-branch.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index 8ddf8513550e..eea6340a0abb 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -46,9 +46,8 @@ */ .macro JMP_NOSPEC 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 + ALTERNATIVE "", __stringify(lfence; jmp *\reg), X86_FEATURE_RETPOLINE_AMD + ALTERNATIVE __stringify(jmp *\reg), __stringify(RETPOLINE_JMP \reg), X86_FEATURE_RETPOLINE #else jmp *\reg #endif -- 2.14.3