evtchn: arrange for preemption in evtchn_destroy()
authorJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 14:15:59 +0000 (16:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 14:15:59 +0000 (16:15 +0200)
commit66cdf341428ae38f6426408a95de9830b5c9c83c
tree9997faf83391b30ec966ad600ee941adbd116b5e
parentecc6428b7ea63a24e244f747e8568c0ccc03a6f8
evtchn: arrange for preemption in evtchn_destroy()

Especially closing of fully established interdomain channels can take
quite some time, due to the locking involved. Therefore we shouldn't
assume we can clean up still active ports all in one go. Besides adding
the necessary preemption check, also avoid pointlessly starting from
(or now really ending at) 0; 1 is the lowest numbered port which may
need closing.

Since we're now reducing ->valid_evtchns, free_xen_event_channel(),
and (at least to be on the safe side) notify_via_xen_event_channel()
need to cope with attempts to close / unbind from / send through already
closed (and no longer valid, as per port_is_valid()) ports.

This is part of XSA-344.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/domain.c
xen/common/event_channel.c
xen/include/xen/sched.h