From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: <linux-kernel@vger.kernel.org>
Cc: <mingo@redhat.com>, <dhaval.giani@oracle.com>,
<konrad.wilk@oracle.com>, <x86@kernel.org>, <tglx@linutronix.de>,
<dwmw@amazon.co.uk>, <bp@suse.de>, <srinivas.eeda@oracle.com>,
<hpa@zytor.com>
Subject: [PATCH v2] x86/speculation: Add RETPOLINE_AMD support to the inline-asm CALL_NOSPEC
Date: Tue, 18 Sep 2018 07:45:00 -0700 (PDT) [thread overview]
Message-ID: <c3975665-173e-4d70-8dee-06c926ac26ee@default> (raw)
..so that they match the asm CALL_NOSPEC.
Add the missing ANNOTATE_NOSPEC_ALTERNATIVE in CALL_NOSPEC.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
arch/x86/include/asm/nospec-branch.h | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index b5b6f8c..b0e80e0 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 */
--
1.7.3
next reply other threads:[~2018-09-18 14:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 14:45 Zhenzhong Duan [this message]
2018-09-24 15:03 ` [tip:x86/pti] x86/speculation: Add RETPOLINE_AMD support to the inline asm CALL_NOSPEC variant tip-bot for Zhenzhong Duan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3975665-173e-4d70-8dee-06c926ac26ee@default \
--to=zhenzhong.duan@oracle.com \
--cc=bp@suse.de \
--cc=dhaval.giani@oracle.com \
--cc=dwmw@amazon.co.uk \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=srinivas.eeda@oracle.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®