x86: fix an off-by-one pirq range check
PATCH 1/1 x86: fix an off-by-one pirq range check
xen/arch/x86/irq.c +1 -1
@@ -1027,7 +1027,7 @@ static void __pirq_guest_eoi(struct domaint pirq_guest_eoi (struct domain *d,int irq) { -if ( (irq <0 ) || (irq > d->nr_pirqs) ) +if ( (irq <0 ) || (irq >= d->nr_pirqs) )return -EINVAL ;__pirq_guest_eoi (d, irq);
Quoted 1 line · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>
Won't that make PV guest with only one IRQ passed through unable to ACK it? (and if the IRQ is not shared that is).
This code does get executed when the PHYSDEVOP_eoi hypercall is made I believe.
Quoted 20 lines
xen/arch/x86/irq.c +1
-1@@ -1027,7 +1027,7 @@ static void __pirq_guest_eoi(struct domaint pirq_guest_eoi (struct domain *d,int irq) { -if ( (irq <0 ) || (irq > d->nr_pirqs) ) +if ( (irq <0 ) || (irq >= d->nr_pirqs) )return -EINVAL ;__pirq_guest_eoi (d, irq);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 1 line · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Won't that make PV guest with only one IRQ passed through unable to ACK it? (and if the IRQ is not shared that is).
Why would you think so? In such a case, nr_pirqs would be 1, and the only permitted pirq would be 0. All other places do the range checks correctly, just this one would let through an out of bounds number.
Jan
Quoted 22 lines
This code does get executed when the
PHYSDEVOP_eoihypercall is made I believe.Quoted 20 lines
xen/arch/x86/irq.c +1
-1@@ -1027,7 +1027,7 @@ static void __pirq_guest_eoi(struct domaint pirq_guest_eoi (struct domain *d,int irq) { -if ( (irq <0 ) || (irq > d->nr_pirqs) ) +if ( (irq <0 ) || (irq >= d->nr_pirqs) )return -EINVAL ;__pirq_guest_eoi (d, irq);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 10 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 1 line · Jan Beulich
Signed-off-by Jan Beulich <[email protected]>Won't that make PV guest with only one IRQ passed through unable to ACK it? (and if the IRQ is not shared that is).
Why would you think so? In such a case,
nr_pirqswould be 1, and the only permitted pirq would be 0. All other places do the range checks correctly, just this one would let through an out of bounds number.
Excellent. Thanks for the answer.