Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2673526imm; Mon, 24 Sep 2018 08:10:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62XnboHRSBA/ThJcVxFr02EnAb7MrBSCcyEutNkb0bd/u6+E+RmIT24ZNhm+CSUe1EYcz0U X-Received: by 2002:a17:902:1101:: with SMTP id d1-v6mr11312681pla.131.1537801846736; Mon, 24 Sep 2018 08:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801846; cv=none; d=google.com; s=arc-20160816; b=onPwJmux1dubEqs9UuXQjihWVFHy/PYylYzOSqHC/QvuqUDo2EA7GtWk5EpJZ1X2a6 6Nf3hvNhOEZu6cQpOnBMsrG20MLdSPJ3Cn3cl/k4xAFQvkqmUcr6Hl+m9Nhnbb7SMKvF ++1rwMGSd+1wv+gy/dw8Ro+qwseboluoTCYZ++77sJrhOSlr8ePDa3S5NTZ9eZ00/Ujc 8GqAu+nKIx7p8ccIcP8Nomk6QZmtchAw3mLVPQuDltviM8NTiLYE2iyjgQuXhAQMvODN lGydfCjK4tG0Z9QIuOIl+ohv1+TAi/3zR0iyVLCx43ytWNHTFDxN6v7nqPaaGQjhYRLe twOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=jKTHuzB6qOXMNKLJpA3wj/SNyBu9e+7vth2und6Hfq4=; b=JRdq+pdWKbGRWRFfmNbL33ksxg6fJeY91Mm0SkjFWT212QUzVe2Qi6a74HfVUmSh4m iMsiW0wh0CT8jtOhjuUogMQloS0Ogyjd8EaDFUak4UjmXIDon5DyhZ9rq6bVfppLawlJ XleNfV36PGbmxsm+hT6elxGf9dEpfuwJrsroJB6HTfCe2UEZbGPd5VPIehyDFPRnGlo5 Zz5yn68XnhuFTDHoogrxY/Ah8Ke2lPAdnWOHaVok068BH38ZiaVVtIrZrpAdWUYdHJfr opQh/f0Mbai/YIhG+ZqdDBgbfo1kN5jeTH3Q9Rmkk5SeC906pW6HZCBcEK0a8Lojrdv+ yHTA== ARC-Authentication-Results: i=1; mx.google.com; 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 z2-v6si35747535pfb.365.2018.09.24.08.10.01; Mon, 24 Sep 2018 08:10:46 -0700 (PDT) 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; 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 S1732884AbeIXVHx (ORCPT + 99 others); Mon, 24 Sep 2018 17:07:53 -0400 Received: from terminus.zytor.com ([198.137.202.136]:36177 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729871AbeIXVHw (ORCPT ); Mon, 24 Sep 2018 17:07:52 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8OF3rnn3096067 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 24 Sep 2018 08:03:53 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8OF3rqu3096064; Mon, 24 Sep 2018 08:03:53 -0700 Date: Mon, 24 Sep 2018 08:03:53 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Zhenzhong Duan Message-ID: Cc: daniel@iogearbox.net, zhenzhong.duan@oracle.com, mingo@redhat.com, udknight@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, bp@suse.de, konrad.wilk@oracle.com, mingo@kernel.org, dwmw@amazon.co.uk Reply-To: bp@suse.de, konrad.wilk@oracle.com, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, dwmw@amazon.co.uk, mingo@kernel.org, zhenzhong.duan@oracle.com, mingo@redhat.com, daniel@iogearbox.net, hpa@zytor.com, udknight@gmail.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/speculation: Add RETPOLINE_AMD support to the inline asm CALL_NOSPEC variant Git-Commit-ID: 0cbb76d6285794f30953bfa3ab831714b59dd700 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0cbb76d6285794f30953bfa3ab831714b59dd700 Gitweb: https://git.kernel.org/tip/0cbb76d6285794f30953bfa3ab831714b59dd700 Author: Zhenzhong Duan AuthorDate: Tue, 18 Sep 2018 07:45:00 -0700 Committer: Borislav Petkov CommitDate: Sun, 23 Sep 2018 15:25:28 +0200 x86/speculation: Add RETPOLINE_AMD support to the inline asm CALL_NOSPEC variant ..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 --- arch/x86/include/asm/nospec-branch.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index fd2a8c1b88bc..80dc14422495 100644 --- 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 */