evtchn/fifo: Don't set PENDING bit if guest misbehaves
authorRaphael Ning <raphning@amazon.com>
Wed, 16 Mar 2022 18:38:41 +0000 (18:38 +0000)
committerJulien Grall <jgrall@amazon.com>
Mon, 21 Mar 2022 10:28:33 +0000 (10:28 +0000)
commit8aa0e9d2d1a4815516607eabe9b2e850f284a2f8
tree38afead7081d082f68e8484a1370709ddae00b20
parentfdfb07eb28e42b456e5e1ce999a47cc3ea439f7f
evtchn/fifo: Don't set PENDING bit if guest misbehaves

Currently, evtchn_fifo_set_pending() will mark the event as PENDING even
if it fails to lock the FIFO event queue(s), or if the guest has not
initialized the FIFO control block for the target vCPU. A well-behaved
guest should never trigger either of these cases.

There is no good reason to set the PENDING bit (the guest should not
depend on this behaviour anyway) or check for pollers in such corner
cases, so skip that. In fact, both the comment above the for loop and
the commit message for

 41a822c39263 xen/events: rework fifo queue locking

suggest that the bit should be set after the FIFO queue(s) are locked.

Take the opportunity to rename the was_pending variable (flipping its
sense) and switch to the standard bool type.

Suggested-by: David Vrabel <dvrabel@amazon.co.uk>
Signed-off-by: Raphael Ning <raphning@amazon.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: David Vrabel <dvrabel@amazon.co.uk>
Tested-by: Luca Fancellu <luca.fancellu@arm.com>
xen/common/event_fifo.c