]> xenbits.xensource.com Git - xen.git/commit
evtchn: check control block exists when using FIFO-based events
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 9 Sep 2014 13:25:58 +0000 (15:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 9 Sep 2014 13:25:58 +0000 (15:25 +0200)
commita4e0cea6fced50e251453dfe52e1b9dde77a84f5
treed11ef3052dd3382ea8332ed6b6e3c0255bfa407e
parent0561e1f01e87b777bcc47971e4ae1f420314f4a0
evtchn: check control block exists when using FIFO-based events

When using the FIFO-based event channels, there are no checks for the
existance of a control block when binding an event or moving it to a
different VCPU.  This is because events may be bound when the ABI is
in 2-level mode (e.g., by the toolstack before the domain is started).

The guest may trigger a Xen crash in evtchn_fifo_set_pending() if:

  a) the event is bound to a VCPU without a control block; or
  b) VCPU 0 does not have a control block.

In case (a), Xen will crash when looking up the current queue.  In
(b), Xen will crash when looking up the old queue (which defaults to a
queue on VCPU 0).

By allocating all the per-VCPU structures when enabling the FIFO ABI,
we can be sure that v->evtchn_fifo is always valid.

EVTCHNOP_init_control_block for all the other CPUs need only map the
shared control block.

A single check in evtchn_fifo_set_pending() before accessing the
control block fixes all cases where the guest has not initialized some
control blocks.

This is XSA-107.

Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/event_fifo.c