x86/irq: fix infinite loop in irq_move_cleanup_interrupt
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 15 Dec 2020 12:42:16 +0000 (13:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 12:42:16 +0000 (13:42 +0100)
commitca85682e8c16361fdf3814c9b25a2ec3ff4f8bed
tree9d40940ada1fdc25aaac209a8e984911d37bc954
parente6ebd394385db52855d1517cea829ffff68b34b8
x86/irq: fix infinite loop in irq_move_cleanup_interrupt

If Xen enters irq_move_cleanup_interrupt with a dynamic vector below
IRQ_MOVE_CLEANUP_VECTOR pending in IRR (0x20 or 0x21) that's also
designated for a cleanup it will enter a loop where
irq_move_cleanup_interrupt continuously sends a cleanup IPI (vector
0x22) to itself while waiting for the vector with lower priority to be
injected - which will never happen because IRQ_MOVE_CLEANUP_VECTOR
takes precedence and it's always injected first.

Fix this by making sure vectors below IRQ_MOVE_CLEANUP_VECTOR are
marked as used and thus not available for APs. Also add some logic to
assert and prevent irq_move_cleanup_interrupt from entering such an
infinite loop, albeit that should never happen given the current code.

This is XSA-356 / CVE-2020-29567.

Fixes: 3fba06ba9f8 ('x86/IRQ: re-use legacy vector ranges on APs')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/irq.c