]> xenbits.xensource.com Git - mini-os.git/commit
Mini-OS: call event handlers always with interrupts off
authorJuergen Gross <jgross@suse.com>
Wed, 13 Dec 2023 09:49:40 +0000 (10:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 13 Dec 2023 09:49:40 +0000 (10:49 +0100)
commitfbf15891cc38eb493c81b02964ba8c48f7ff6f63
tree13cb3870cd072ab8ef771d2662c560dbd26a9d25
parent23247d6586110ec3d73cae8a693c0db879a58184
Mini-OS: call event handlers always with interrupts off

When unmasking an event channel the associated event handler can be
called with interrupts enabled when not running as a PV guest.

This can result in hard to debug races in case e.g. a handler is
registered for multiple events or when the handler is not using a lock
as it assumes to have interrupts disabled.

Instead of using the PV interrupt disabling points just before calling
the handler, do the disabling once at the very start of
force_evtchn_callback().

Replace the evtchn_upcall_mask test in unmask_evtchn() with the more
appropriate irqs_disabled() test.

As a precaution add a test to do_hypervisor_callback() that interrupts
are really disabled and crash in case this is not true.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
hypervisor.c