Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8131364imu; Tue, 4 Dec 2018 03:33:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/UZNHR0eJGTBXdaTQL/nxSKeOaBnEOXigKb19Tx1fB96qlju4VTAnIpMgV1Vzk+e11ZnMW2 X-Received: by 2002:a17:902:1745:: with SMTP id i63mr19216833pli.145.1543923183441; Tue, 04 Dec 2018 03:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543923183; cv=none; d=google.com; s=arc-20160816; b=bWuG+IkYGVH5KD5FB3av/7yDvCr829/QFvoA13yY8U2f4G33c+rFVd7Z9qLD8TvdR2 nEZME6dy7ofY3uJMY0ntKUYDRERalgwfNAByzwTrYyMbo28JVlJx2P1kvsD/+pH8v58+ MtkGz6lhVLCHRb3Glix1EukdIG6iC/76KbVFV51YJsewaNvWUaIrH0OYRbkNpvY5aIQB 6gIn9OBcUyXKfQ5IHzTgNmCFcg0roINMoGJVGlIBx4mgwUWcT3VFpj7p5Lu+9JzB7iLl elMF/0sHV1SjiI1WpafUobDFMP3D1A/y84fLYK51tvR7ixOpd7b4p7DVdJBXxTq3AK0W /HVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3BU1O6bLgzXEFdrUW6po7S6WhUl2Mc6mWVi9URTtfwY=; b=dEICl2NtB2k20Kt4YC3nPBm30Gr0gMPs1gwJj8ojVsJgNWsvTo5LFv1kuJ/0vvRMmh HQxrkRuNao2DpfNZv68sYYFu37MRo9cNGX+Ip9grjk9urnB8CGw50cs47PlbbyRkRRrx j9MuV1ScWbjXAEMZ5aX2PNHdnW9t343C5yDPTiRYbi4eW53XCU6g1lROvvibDI6JNlbx LNUmsWrYe6AOkZh34IyzJRVXtxwMHFL2V7EdOxMrGGHbMYnVYJ0nXPuW0C3M3Aas652y COWuFvDLKVXBiHjPMjc7AHCXJCw4MAp4wZU07NyDTlcbUTUuDZCZ0IW5vWVMQFcCWDZH bYfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRQMHUTP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si17295811pfn.277.2018.12.04.03.32.47; Tue, 04 Dec 2018 03:33:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IRQMHUTP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbeLDK4Q (ORCPT + 99 others); Tue, 4 Dec 2018 05:56:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:39368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726433AbeLDK4N (ORCPT ); Tue, 4 Dec 2018 05:56:13 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B6A2214E0; Tue, 4 Dec 2018 10:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543920973; bh=snsz46gomAVnQS/Jap3ESWcxcwYAN9r7BtDuW+dhXTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRQMHUTPphvQs/HWYV6yS/fCViQzeg80mWoAr9NzjcBGXW82jLIsTzxiKnRtAj49G YaKFpAXkZRNyTFKcd/Dk5ndyoOeKXbfv7EnVvC6WV4xH3FdhAK01YOg3PbH/QungZX Gn/ILHdqNtRymhC2ni1bpFvPOe7LsJVsEHog2Ph0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenzhong Duan , Borislav Petkov , Daniel Borkmann , David Woodhouse , "H. Peter Anvin" , Ingo Molnar , Konrad Rzeszutek Wilk , Peter Zijlstra , Thomas Gleixner , Wang YanQing , dhaval.giani@oracle.com, srinivas.eeda@oracle.com Subject: [PATCH 4.19 030/139] x86/speculation: Add RETPOLINE_AMD support to the inline asm CALL_NOSPEC variant Date: Tue, 4 Dec 2018 11:48:31 +0100 Message-Id: <20181204103651.217503073@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhenzhong Duan zhenzhong.duan@oracle.com commit 0cbb76d6285794f30953bfa3ab831714b59dd700 upstream ..so that they match their asm counterpart. Add the missing ANNOTATE_NOSPEC_ALTERNATIVE in CALL_NOSPEC, while at it. Signed-off-by: Zhenzhong Duan Signed-off-by: Borislav Petkov Cc: Daniel Borkmann Cc: David Woodhouse Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Konrad Rzeszutek Wilk Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Wang YanQing Cc: dhaval.giani@oracle.com Cc: srinivas.eeda@oracle.com Link: http://lkml.kernel.org/r/c3975665-173e-4d70-8dee-06c926ac26ee@default Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/nospec-branch.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -170,11 +170,15 @@ */ # define CALL_NOSPEC \ ANNOTATE_NOSPEC_ALTERNATIVE \ - ALTERNATIVE( \ + ALTERNATIVE_2( \ ANNOTATE_RETPOLINE_SAFE \ "call *%[thunk_target]\n", \ "call __x86_indirect_thunk_%V[thunk_target]\n", \ - X86_FEATURE_RETPOLINE) + X86_FEATURE_RETPOLINE, \ + "lfence;\n" \ + ANNOTATE_RETPOLINE_SAFE \ + "call *%[thunk_target]\n", \ + X86_FEATURE_RETPOLINE_AMD) # define THUNK_TARGET(addr) [thunk_target] "r" (addr) #elif defined(CONFIG_X86_32) && defined(CONFIG_RETPOLINE) @@ -184,7 +188,8 @@ * here, anyway. */ # define CALL_NOSPEC \ - ALTERNATIVE( \ + ANNOTATE_NOSPEC_ALTERNATIVE \ + ALTERNATIVE_2( \ ANNOTATE_RETPOLINE_SAFE \ "call *%[thunk_target]\n", \ " jmp 904f;\n" \ @@ -199,7 +204,11 @@ " ret;\n" \ " .align 16\n" \ "904: call 901b;\n", \ - X86_FEATURE_RETPOLINE) + X86_FEATURE_RETPOLINE, \ + "lfence;\n" \ + ANNOTATE_RETPOLINE_SAFE \ + "call *%[thunk_target]\n", \ + X86_FEATURE_RETPOLINE_AMD) # define THUNK_TARGET(addr) [thunk_target] "rm" (addr) #else /* No retpoline for C / inline asm */