tools/xenstore: let unread watch events time out
authorJuergen Gross <jgross@suse.com>
Tue, 13 Sep 2022 05:35:07 +0000 (07:35 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 1 Nov 2022 14:07:24 +0000 (14:07 +0000)
commitd08cdf0b19daf948a6b9754e90de9bc304bcd262
tree93121355deb18f516c6917f641cdf54a6ffcc1d0
parente26d6f4d1b389b859fb5a6570421e80e0213f92b
tools/xenstore: let unread watch events time out

A future modification will limit the number of outstanding requests
for a domain, where "outstanding" means that the response of the
request or any resulting watch event hasn't been consumed yet.

In order to avoid a malicious guest being capable to block other guests
by not reading watch events, add a timeout for watch events. In case a
watch event hasn't been consumed after this timeout, it is being
deleted. Set the default timeout to 20 seconds (a random value being
not too high).

In order to support to specify other timeout values in future, use a
generic command line option for that purpose:

--timeout|-w watch-event=<seconds>

This is part of XSA-326 / CVE-2022-42311.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit 5285dcb1a5c01695c11e6397c95d906b5e765c98)
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h