x86/physdev: Range check pirq parameter from guests 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 Acked-by: Jan Beulich Acked-by: Ian Campbell diff -r 7a401a73d86d xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -234,6 +234,10 @@ static int physdev_unmap_pirq(struct phy 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);