]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
xen: allow limiting the amount of duplicated pending xenstore watches
authorRoger Pau Monné <royger@FreeBSD.org>
Wed, 25 Nov 2020 11:34:38 +0000 (12:34 +0100)
committerEd Maste <emaste@FreeBSD.org>
Fri, 29 Jan 2021 01:00:20 +0000 (20:00 -0500)
commit785afb167cc4cdbf4d281da214456cb4ef12469d
tree6fb927a1de643dd022040f5d744610def59ac503
parentee4693d4dac855f136a62ca3d43b7c289185856d
xen: allow limiting the amount of duplicated pending xenstore watches

Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

(cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6)
(cherry picked from commit 2d194dc219892049dd03564c4083080cac1aa688)

Approved by: so
Security: XSA-349, CVE-2020-29568
sys/dev/xen/balloon/balloon.c
sys/dev/xen/blkback/blkback.c
sys/dev/xen/control/control.c
sys/dev/xen/xenstore/xenstore.c
sys/dev/xen/xenstore/xenstore_dev.c
sys/xen/xenbus/xenbusb.c
sys/xen/xenstore/xenstorevar.h