xen/arm32: Don't blindly unmask interrupts on trap without a change of level
authorJulien Grall <julien.grall@arm.com>
Fri, 11 Oct 2019 16:49:28 +0000 (17:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 31 Oct 2019 15:22:34 +0000 (16:22 +0100)
commit61b683571f0abd12395b1454cd055f2ad9bb3a37
treedf30d29e2050a3ecc034f9c210f3f737f5f9f28b
parenta7b81b021ead23bffb5affcac05edfc0a84d129d
xen/arm32: Don't blindly unmask interrupts on trap without a change of level

Exception vectors will unmask interrupts regardless the state of them in
the interrupted context.

One of the consequences is IRQ will be unmasked when receiving an
undefined instruction exception (used by WARN*) from the hypervisor.
This could result to unexpected behavior such as deadlock (if a lock was
shared with interrupts).

In a nutshell, interrupts should only be unmasked when it is safe to do.
Xen only unmask IRQ and Abort interrupts, so the logic can stay simple.

As vectors exceptions may be shared between guest and hypervisor, we now
need to have a different policy for the interrupts.

On exception from hypervisor, each vector will select the list of
interrupts to inherit from the interrupted context. Any interrupts not
listed will be kept masked.

On exception from the guest, the Abort and IRQ will be unmasked
depending on the exact vector.

The interrupts will be kept unmasked when the vector cannot used by
either guest or hypervisor.

Note that each vector is not anymore preceded by ALIGN. This is fine
because the alignment is already bigger than what we need.

This is part of XSA-303.

Reported-by: Julien Grall <Julien.Grall@arm.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
xen/arch/arm/arm32/entry.S