Skip to contentSkip to conversation

arm/vgic-v3: Fix data abort in get_vcpu_from_rdist()

PATCH In review Andrew Cooper 2 participants 2 messages Jul 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/vgic-v3: Fix data abort in get_vcpu_from_rdist()

Just because vcpu_id is within d->max_vcpus doesn't mean d->vcpu[vcpu_id] is non-NULL. Use the proper accessor to look up a vcpu object.

Fixes acf65e5a25a7 ("xen/arm: vgic-v3: Emulate correctly the re-distributor")

---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>

Untested. This came from review discusson on a separate patch.

---
 xen/arch/arm/vgic-v3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/vgic-v3.c +3 -3
index c1c4d6f71ea8..c01cc596d593 100644
@@ -1111,10 +1111,10 @@ static struct vcpu *get_vcpu_from_rdist(struct domain *d,
     unsigned int vcpu_id;
 
     vcpu_id = region->first_cpu + ((gpa - region->base) / GICV3_GICR_SIZE);
-    if ( unlikely(vcpu_id >= d->max_vcpus) )
-        return NULL;
 
-    v = d->vcpu[vcpu_id];
+    v = domain_vcpu(d, vcpu_id);
+    if ( !v )
+        return NULL;
 
     *offset = gpa - v->arch.vgic.rdist_base;
 

base-commit: c4bf5bc5f0edbcbc5965c924db069483b2cf6049

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw

Hi Andrew,

Quoted 6 lines · Andrew Cooper

Just because vcpu_id is within d->max_vcpus doesn't mean d->vcpu[vcpu_id] is non-NULL. Use the proper accessor to look up a vcpu object.

Fixes acf65e5a25a7 ("xen/arm: vgic-v3: Emulate correctly the re-distributor")

Cheers,

Signature · 1 line
Julien Grall