All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 15/17] x86emul: adjust_bnd() should check XCR0
Date: Thu, 14 Sep 2017 09:20:42 -0600	[thread overview]
Message-ID: <59BABA6A020000780017B3F9@prv-mh.provo.novell.com> (raw)
In-Reply-To: <59BAB38A020000780017B34E@prv-mh.provo.novell.com>

Experimentally MPX instructions have been confirmed to behave as NOPs
unless both related XCR0 bits are set to 1. By implication branches
then also don't clear BNDn.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2141,12 +2141,16 @@ static bool umip_active(struct x86_emula
 static void adjust_bnd(struct x86_emulate_ctxt *ctxt,
                        const struct x86_emulate_ops *ops, enum vex_pfx pfx)
 {
-    uint64_t bndcfg;
+    uint64_t xcr0, bndcfg;
     int rc;
 
     if ( pfx == vex_f2 || !cpu_has_mpx || !vcpu_has_mpx() )
         return;
 
+    if ( !ops->read_xcr || ops->read_xcr(0, &xcr0, ctxt) != X86EMUL_OKAY ||
+         !(xcr0 & XSTATE_BNDREGS) || !(xcr0 & XSTATE_BNDCSR) )
+        return;
+
     if ( !mode_ring0() )
         bndcfg = read_bndcfgu();
     else if ( !ops->read_msr ||




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

  parent reply	other threads:[~2017-09-14 15:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 14:51 [PATCH v2 00/17] x86: emulator enhancements Jan Beulich
2017-09-14 15:12 ` [PATCH v2 01/17] x86emul: support remaining AVX insns Jan Beulich
2017-10-09 15:36   ` George Dunlap
2017-10-09 16:12     ` Jan Beulich
2017-10-10 14:17       ` George Dunlap
2017-09-14 15:12 ` [PATCH v2 02/17] x86emul: re-order cases of main switch statement Jan Beulich
2017-09-15 17:23   ` Andrew Cooper
2017-09-14 15:13 ` [PATCH v2 03/17] x86emul: build SIMD tests with -Os Jan Beulich
2017-09-14 15:13 ` [PATCH v2 04/17] x86emul: support F16C insns Jan Beulich
2017-09-14 15:14 ` [PATCH v2 05/17] x86emul: support FMA4 insns Jan Beulich
2017-09-14 15:14 ` [PATCH v2 06/17] x86emul: support FMA insns Jan Beulich
2017-09-14 15:15 ` [PATCH v2 07/17] x86emul: support most remaining AVX2 insns Jan Beulich
2017-09-14 15:16 ` [PATCH v2 08/17] x86emul: fold/eliminate some local variables Jan Beulich
2017-09-15 17:22   ` Andrew Cooper
2017-10-06 14:21   ` George Dunlap
2017-10-06 14:47     ` Jan Beulich
2017-10-06 14:43   ` George Dunlap
2017-09-14 15:17 ` [PATCH v2 09/17] x86emul: support AVX2 gather insns Jan Beulich
2017-09-14 15:17 ` [PATCH v2 10/17] x86emul: add tables for XOP 08 and 09 extension spaces Jan Beulich
2017-09-14 15:18 ` [PATCH v2 11/17] x86emul: support XOP insns Jan Beulich
2017-09-14 15:18 ` [PATCH v2 12/17] x86emul: support 3DNow! insns Jan Beulich
2017-09-14 15:19 ` [PATCH v2 13/17] x86emul: re-order checks in test harness Jan Beulich
2017-09-15 17:26   ` Andrew Cooper
2017-09-14 15:20 ` [PATCH v2 14/17] x86emul: abstract out XCRn accesses Jan Beulich
2017-09-14 15:25   ` Jan Beulich
2017-09-18  9:12   ` Paul Durrant
2017-09-14 15:20 ` Jan Beulich [this message]
2017-09-14 15:21 ` [PATCH v2 16/17] x86emul: make all FPU emulation use the stub Jan Beulich
2017-09-14 15:22 ` [PATCH v2 17/17] x86/HVM: eliminate custom #MF/#XM handling Jan Beulich
2017-09-18  9:27   ` Paul Durrant
2017-09-18  9:35     ` Jan Beulich

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=59BABA6A020000780017B3F9@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.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.