All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: JBeulich@suse.com, andrew.cooper3@citrix.com
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Xen-Devel <xen-devel@lists.xen.org>,
	Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
Subject: [PATCH] Choose retpoline only when it is safe to use
Date: Tue, 6 Feb 2018 00:43:02 -0800 (PST)	[thread overview]
Message-ID: <d4c3bc09-c284-4372-acb4-27f0d913afe2@default> (raw)

When ( ibrs && thunk == THUNK_DEFAULT && !retpoline_safe() ) is true,
thunk is set to THUNK_JMP rather than THUNK_RETPOLINE.

When (!ibrs && thunk == THUNK_DEFAULT && !retpoline_safe() ) is true,
we should do the same.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
 xen/arch/x86/spec_ctrl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index f10ffbf..ab4b244 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -247,10 +247,10 @@ void __init init_speculation_mitigations(void)
 
     /*
      * If there are still no thunk preferences, the compiled default is
-     * actually retpoline, and it is better than nothing.
+     * actually retpoline, and it is better than nothing if it's retpoline safe.
      */
     if ( thunk == THUNK_DEFAULT )
-        thunk = THUNK_RETPOLINE;
+        thunk = retpoline_safe() ? THUNK_RETPOLINE : THUNK_JMP;
 
     /* Apply the chosen settings. */
     if ( thunk == THUNK_LFENCE )
-- 
1.7.3

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2018-02-06  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06  8:43 Zhenzhong Duan [this message]
2018-02-06  8:59 ` [PATCH] Choose retpoline only when it is safe to use Andrew Cooper
2018-02-06  9:13   ` Zhenzhong Duan
2018-02-06  9:20     ` Andrew Cooper

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=d4c3bc09-c284-4372-acb4-27f0d913afe2@default \
    --to=zhenzhong.duan@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=srinivas.eeda@oracle.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.