]> xenbits.xensource.com Git - xen.git/commitdiff
x86/physdev: Range check pirq parameter from guests
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 14 Nov 2012 11:35:06 +0000 (11:35 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 14 Nov 2012 11:35:06 +0000 (11:35 +0000)
Otherwise Xen will read beyond either end of the struct
domain.arch.pirq_emuirq array, usually resulting in a fatal page fault.

This vulnerability was introduced by c/s 23241:d21100f1d00e, which adds
a call to domain_pirq_to_emuirq() which uses the guest provided pirq
value before range checking it, and was fixed by c/s 23573:584c2e5e03d9
which changed the behaviour of the domain_pirq_to_emuirq() macro to use
radix trees instead of a flat array.

This is XSA-21 / CVE-2012-4536.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/arch/x86/physdev.c

index 7d5a0234ef480847eef9c7d470d54526ad89fa5b..de364f0c8d681a8c5fc23d9d0859743c340535d2 100644 (file)
@@ -234,6 +234,10 @@ static int physdev_unmap_pirq(struct physdev_unmap_pirq *unmap)
     if ( ret )
         return ret;
 
+    ret = -EINVAL;
+    if ( unmap->pirq < 0 || unmap->pirq >= d->nr_pirqs )
+        goto free_domain;
+
     if ( is_hvm_domain(d) )
     {
         spin_lock(&d->event_lock);