]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
common/domain: block speculative out-of-bound accesses
authorNorbert Manthey <nmanthey@amazon.de>
Thu, 14 Mar 2019 12:57:00 +0000 (13:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 Apr 2019 10:19:03 +0000 (12:19 +0200)
When issuing a vcpu_op hypercall, guests have control over the
vcpuid variable. In the old code, this allowed to perform
speculative out-of-bound accesses. To block this, we make use
of the domain_vcpu function.

This is part of the speculative hardening effort.

Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/domain.c

index a1f8bb4f2f4f608647adcdf7daaca28d8b391585..88bbe984bc6ce645a00a0d4d864685ff416acd72 100644 (file)
@@ -1364,7 +1364,7 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
     struct vcpu *v;
     long rc = 0;
 
-    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    if ( (v = domain_vcpu(d, vcpuid)) == NULL )
         return -ENOENT;
 
     switch ( cmd )