Skip to contentSkip to conversation

vvmx: fix L1 vmxon

PATCH Superseded Haozhong Zhang 5 participants 18 messages Dec 13, 2016 – Dec 14, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover vvmx: fix L1 vmxon

This patchset fixes bugs and adds missing checks in nvmx_handle_vmxon(), in order to make it more consistent to Intel SDM (section "VMXON - Enter VMX Operation" in Vol 3).

Haozhong Zhang (3):
vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address
vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation
vvmx: check the operand of L1 vmxon

 xen/arch/x86/hvm/vmx/vvmx.c | 45 ++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 7 deletions(-)
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 1/3 vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

nvmx_handle_vmxon() previously checks whether a vcpu is in VMX operation by comparing its vmxon_region_pa with GPA 0. However, 0 is also a valid VMXON region address. If L1 hypervisor had set the VMXON region address to 0, the check in nvmx_handle_vmxon() will be skipped. Fix this problem by using an invalid VMXON region address for vcpu out of VMX operation.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +16 -4
index e6e9ebd..f5637eb 100644
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)
+
+static bool nvmx_vcpu_in_vmx(struct vcpu *v)
+{
+    return vcpu_2_nvmx(v).vmxon_region_pa != INVALID_VMXON_REGION_PA;
+}
+
 #define VMCS_BUF_SIZE 100
 
 int nvmx_cpu_up_prepare(unsigned int cpu)
@@ -107,7 +119,7 @@ int nvmx_vcpu_initialise(struct vcpu *v)
 
     nvmx->ept.enabled = 0;
     nvmx->guest_vpid = 0;
-    nvmx->vmxon_region_pa = 0;
+    nvmx->vmxon_region_pa = INVALID_VMXON_REGION_PA;
     nvcpu->nv_vvmcx = NULL;
     nvcpu->nv_vvmcxaddr = VMCX_EADDR;
     nvmx->intr.intr_info = 0;
@@ -357,7 +369,7 @@ static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check)
              !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_VMXE) )
             goto invalid_op;
     }
-    else if ( !vcpu_2_nvmx(v).vmxon_region_pa )
+    else if ( !nvmx_vcpu_in_vmx(v) )
         goto invalid_op;
 
     hvm_get_segment_register(v, x86_seg_cs, &cs);
@@ -1384,7 +1396,7 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( nvmx->vmxon_region_pa )
+    if ( nvmx_vcpu_in_vmx(v) )
         gdprintk(XENLOG_WARNING, 
                  "vmxon again: orig %"PRIpaddr" new %lx\n",
                  nvmx->vmxon_region_pa, gpa);
@@ -1417,7 +1429,7 @@ int nvmx_handle_vmxoff(struct cpu_user_regs *regs)
         return rc;
 
     nvmx_purge_vvmcs(v);
-    nvmx->vmxon_region_pa = 0;
+    nvmx->vmxon_region_pa = INVALID_VMXON_REGION_PA;
 
     vmreturn(regs, VMSUCCEED);
     return X86EMUL_OKAY;
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

Quoted 18 lines · Haozhong Zhang

nvmx_handle_vmxon() previously checks whether a vcpu is in VMX operation by comparing its vmxon_region_pa with GPA 0. However, 0 is also a valid VMXON region address. If L1 hypervisor had set the VMXON region address to 0, the check in nvmx_handle_vmxon() will be skipped. Fix this problem by using an invalid VMXON region address for vcpu out of VMX operation.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
index e6e9ebd..f5637eb 100644
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 42

Quoted 10 lines
xen/arch/x86/hvm/vmx/vvmx.c +8 -0
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)
+
+static bool nvmx_vcpu_in_vmx(struct vcpu *v)

const struct vcpu *v.

Otherwise, Reviewed-by: Andrew Cooper <[email protected]>

I can fix this up on commit if no other issues are found by the other reviewers.

Quoted 35 lines
xen/arch/x86/hvm/vmx/vvmx.c +7 -3
+{
+    return vcpu_2_nvmx(v).vmxon_region_pa != INVALID_VMXON_REGION_PA;
+}
+
 #define VMCS_BUF_SIZE 100
 
 int nvmx_cpu_up_prepare(unsigned int cpu)
@@ -107,7 +119,7 @@ int nvmx_vcpu_initialise(struct vcpu *v)
 
     nvmx->ept.enabled = 0;
     nvmx->guest_vpid = 0;
-    nvmx->vmxon_region_pa = 0;
+    nvmx->vmxon_region_pa = INVALID_VMXON_REGION_PA;
     nvcpu->nv_vvmcx = NULL;
     nvcpu->nv_vvmcxaddr = VMCX_EADDR;
     nvmx->intr.intr_info = 0;
@@ -357,7 +369,7 @@ static int vmx_inst_check_privilege(struct cpu_user_regs *regs, int vmxop_check)
              !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_VMXE) )
             goto invalid_op;
     }
-    else if ( !vcpu_2_nvmx(v).vmxon_region_pa )
+    else if ( !nvmx_vcpu_in_vmx(v) )
         goto invalid_op;
 
     hvm_get_segment_register(v, x86_seg_cs, &cs);
@@ -1384,7 +1396,7 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( nvmx->vmxon_region_pa )
+    if ( nvmx_vcpu_in_vmx(v) )
         gdprintk(XENLOG_WARNING, 
                  "vmxon again: orig %"PRIpaddr" new %lx\n",
                  nvmx->vmxon_region_pa, gpa);

xen/arch/x86/hvm/vmx/vvmx.c int nvmx_handle_vmxoff(struct cpu_user_regs *regs) · line 1435

Quoted 8 lines
xen/arch/x86/hvm/vmx/vvmx.c +1 -1
@@ -1417,7 +1429,7 @@ int nvmx_handle_vmxoff(struct cpu_user_regs *regs)
         return rc;
 
     nvmx_purge_vvmcs(v);
-    nvmx->vmxon_region_pa = 0;
+    nvmx->vmxon_region_pa = INVALID_VMXON_REGION_PA;
 
     vmreturn(regs, VMSUCCEED);
     return X86EMUL_OKAY;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

Quoted 32 lines · Andrew Cooper
Quoted 18 lines · Haozhong Zhang

nvmx_handle_vmxon() previously checks whether a vcpu is in VMX operation by comparing its vmxon_region_pa with GPA 0. However, 0 is also a valid VMXON region address. If L1 hypervisor had set the VMXON region address to 0, the check in nvmx_handle_vmxon() will be skipped. Fix this problem by using an invalid VMXON region address for vcpu out of VMX operation.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
index e6e9ebd..f5637eb 100644
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 42

Quoted 10 lines
xen/arch/x86/hvm/vmx/vvmx.c +8 -0
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)
+
+static bool nvmx_vcpu_in_vmx(struct vcpu *v)

const struct vcpu *v.

Quoted 1 line

Otherwise, Reviewed-by: Andrew Cooper <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

In reply to Haozhong Zhang

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 40

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 13.12.16 at 13:16, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vvmx.c +6 -0
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)

vmxon_region_pa being paddr_t, I think this would better be explicitly paddr_t, too (rather than unsigned long).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

In reply to Haozhong Zhang

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 40

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 13.12.16 at 13:16, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vvmx.c +6 -0
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)

And btw, having looked at patch 2 - any reason you can't simply re-use VMCX_EADDR here?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 13.12.16 at 13:16, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
Quoted 10 lines

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 40

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +6 -0
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)

And btw, having looked at patch 2 - any reason you can't simply re-use VMCX_EADDR here?

I just find INVALID_PADDR defined along with type paddr_t:

typedef unsigned long paddr_t;
#define INVALID_PADDR (~0UL)

Which one, INVALID_PADDR or VMCX_EADDR, would be better?

Thanks,
Haozhong

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 14.12.16 at 02:37, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 13.12.16 at 13:16, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
@@ -32,6 +32,18 @@ static DEFINE_PER_CPU(u64 *, vvmcs_buf);
 
 static void nvmx_purge_vvmcs(struct vcpu *v);
 
Quoted 10 lines

xen/arch/x86/hvm/vmx/vvmx.c static DEFINE_PER_CPU(u64 *, vvmcs_buf); · line 40

Quoted 6 lines
xen/arch/x86/hvm/vmx/vvmx.c +6 -0
+/*
+ * When a vcpu is out of VMXON region, set its vmxon_region_pa to
+ * INVALID_VMXON_REGION_PA. We cannot use 0, because 0 is also a valid
+ * VMXON region address.
+ */
+#define INVALID_VMXON_REGION_PA (~0UL)

And btw, having looked at patch 2 - any reason you can't simply re-use VMCX_EADDR here?

Quoted 6 lines

I just find INVALID_PADDR defined along with type paddr_t:

typedef unsigned long paddr_t;
#define INVALID_PADDR (~0UL)

Which one, INVALID_PADDR or VMCX_EADDR, would be better?

The former then, I would say. And perhaps ditch VMCX_EADDR in a separate patch then too, in favor of the more general one.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/3
#8 lore raw

Re: [PATCH 1/3] vvmx: set vmxon_region_pa of vcpu out of VMX operation to an invalid address

In reply to Haozhong Zhang
Quoted 11 lines

From: Zhang, Haozhong
Sent: Tuesday, December 13, 2016 8:16 PM

nvmx_handle_vmxon() previously checks whether a vcpu is in VMX operation by comparing its vmxon_region_pa with GPA 0. However, 0 is also a valid VMXON region address. If L1 hypervisor had set the VMXON region address to 0, the check in nvmx_handle_vmxon() will be skipped. Fix this problem by using an invalid VMXON region address for vcpu out of VMX operation.

once you have type thing fixed:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw

PATCH 2/3 vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation

In reply to Haozhong Zhang

According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +6 -3
index f5637eb..b60d7f0 100644
@@ -1397,9 +1397,12 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
         return rc;
 
     if ( nvmx_vcpu_in_vmx(v) )
-        gdprintk(XENLOG_WARNING, 
-                 "vmxon again: orig %"PRIpaddr" new %lx\n",
-                 nvmx->vmxon_region_pa, gpa);
+    {
+        vmreturn(regs,
+                 nvcpu->nv_vvmcxaddr != VMCX_EADDR ?
+                 VMFAIL_VALID : VMFAIL_INVALID);
+        return X86EMUL_OKAY;
+    }
 
     nvmx->vmxon_region_pa = gpa;
 
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 2/3
#10 lore raw

Re: [PATCH 2/3] vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation

Quoted 5 lines · Haozhong Zhang

According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message.

Quoted 9 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +0 -0
index f5637eb..b60d7f0 100644

xen/arch/x86/hvm/vmx/vvmx.c int nvmx_handle_vmxon(struct cpu_user_regs *regs) · line 1403

Quoted 10 lines
xen/arch/x86/hvm/vmx/vvmx.c +4 -3
@@ -1397,9 +1397,12 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
         return rc;
 
     if ( nvmx_vcpu_in_vmx(v) )
-        gdprintk(XENLOG_WARNING, 
-                 "vmxon again: orig %"PRIpaddr" new %lx\n",
-                 nvmx->vmxon_region_pa, gpa);
+    {
+        vmreturn(regs,
+                 nvcpu->nv_vvmcxaddr != VMCX_EADDR ?
+                 VMFAIL_VALID : VMFAIL_INVALID);

vmreturn really should take a single fail option and internally turn this into VMFAIL_{VALID,INVALID}, rather than requiring the caller to do so.

~Andrew

xen/arch/x86/hvm/vmx/vvmx.c int nvmx_handle_vmxon(struct cpu_user_regs *regs) · line 1408

Quoted 5 lines
xen/arch/x86/hvm/vmx/vvmx.c +2 -0
+        return X86EMUL_OKAY;
+    }
 
     nvmx->vmxon_region_pa = gpa;
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH 2/3] vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation

In reply to Haozhong Zhang
Quoted 3 lines · Haozhong Zhang

According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message.

The spec also says to return value 15? But I suppose that means the TOOD in vmreturn should be implemented?

Quoted 34 lines
---
 xen/arch/x86/hvm/vmx/vvmx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +6 -3
index f5637eb..b60d7f0 100644
@@ -1397,9 +1397,12 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
         return rc;
 
     if ( nvmx_vcpu_in_vmx(v) )
-        gdprintk(XENLOG_WARNING, 
-                 "vmxon again: orig %"PRIpaddr" new %lx\n",
-                 nvmx->vmxon_region_pa, gpa);
+    {
+        vmreturn(regs,
+                 nvcpu->nv_vvmcxaddr != VMCX_EADDR ?
+                 VMFAIL_VALID : VMFAIL_INVALID);
+        return X86EMUL_OKAY;
+    }
 
     nvmx->vmxon_region_pa = gpa;
 
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH 2/3] vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation

Quoted 8 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Haozhong Zhang

According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message.

The spec also says to return value 15? But I suppose that means the TOOD in vmreturn should be implemented?

Yes, it's on my TODO list.

Haozhong

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 2/3
#13 lore raw

Re: [PATCH 2/3] vvmx: return VMfail to L1 if L1 vmxon is executed in VMX operation

In reply to Haozhong Zhang
Quoted 8 lines

From: Zhang, Haozhong
Sent: Tuesday, December 13, 2016 8:16 PM

According to Intel SDM, section "VMXON - Enter VMX Operation", a VMfail should be returned to L1 hypervisor if L1 vmxon is executed in VMX operation, rather than just print a warning message.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw

PATCH 3/3 vvmx: check the operand of L1 vmxon

In reply to Haozhong Zhang

Check whether the operand of L1 vmxon is a valid VMXON region address and whether the VMXON region at that address contains a valid revision ID.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
xen/arch/x86/hvm/vmx/vvmx.c +16 -0
index b60d7f0..7cee307 100644
@@ -1390,6 +1390,7 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
     struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
     struct vmx_inst_decoded decode;
     unsigned long gpa = 0;
+    uint32_t nvmcs_revid;
     int rc;
 
     rc = decode_vmx_inst(regs, &decode, &gpa, 1);
@@ -1404,6 +1405,21 @@ int nvmx_handle_vmxon(struct cpu_user_regs *regs)
         return X86EMUL_OKAY;
     }
 
+    if ( (gpa & ~PAGE_MASK) || (gpa >> v->domain->arch.paging.gfn_bits) )
+    {
+        vmreturn(regs, VMFAIL_INVALID);
+        return X86EMUL_OKAY;
+    }
+
+    rc = hvm_copy_from_guest_phys(&nvmcs_revid, gpa, sizeof(nvmcs_revid));
+    if ( rc != HVMCOPY_okay ||
+         (nvmcs_revid & ~VMX_BASIC_REVISION_MASK) ||
+         ((nvmcs_revid ^ vmx_basic_msr) & VMX_BASIC_REVISION_MASK) )
+    {
+        vmreturn(regs, VMFAIL_INVALID);
+        return X86EMUL_OKAY;
+    }
+
     nvmx->vmxon_region_pa = gpa;
 
     /*
Signature · 7 lines
2.10.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 3/3
#15 lore raw

Re: [PATCH 3/3] vvmx: check the operand of L1 vmxon

Quoted 5 lines · Haozhong Zhang

Check whether the operand of L1 vmxon is a valid VMXON region address and whether the VMXON region at that address contains a valid revision ID.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 3/3
#16 lore raw

Re: [PATCH 3/3] vvmx: check the operand of L1 vmxon

In reply to Haozhong Zhang
Quoted 5 lines · Haozhong Zhang

Check whether the operand of L1 vmxon is a valid VMXON region address and whether the VMXON region at that address contains a valid revision ID.

Thank you finding these and fixing them!

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 3/3
#17 lore raw

Re: [PATCH 3/3] vvmx: check the operand of L1 vmxon

In reply to Haozhong Zhang
Quoted 8 lines

From: Zhang, Haozhong
Sent: Tuesday, December 13, 2016 8:16 PM

Check whether the operand of L1 vmxon is a valid VMXON region address and whether the VMXON region at that address contains a valid revision ID.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel