freebsd-dev/sys/xen
Roger Pau Monné f3d54ded28 xenbus: improve device tracking
xenbus needs to keep track of the devices exposed on xenstore, so that
it can trigger frontend and backend device creation.

Removal of backend devices is currently detected by checking the
existence of the device (backend) xenstore directory, but that's prone
to races as the device driver would usually add entries to such
directory itself, so under certain circumstances it's possible for a
driver to add node to the directory after the toolstack has removed
it.  This leads to devices not removed, which can eventually exhaust
the memory of FreeBSD.

Fix this by checking for the existence of the 'state' node instead of
the directory, as such node will always be present when a device is
active, and will be removed by the toolstack when the device is shut
down.  In order to avoid any races with the updating of the 'state'
node by FreeBSD and the toolstack removing it use a transaction in
xenbusb_write_ivar() for that purpose.

Reported by: Ze Dupsys <zedupsys@gmail.com>
Sponsored by: Citrix Systems R&D
2022-06-07 12:29:53 +02:00
..
evtchn
xenbus xenbus: improve device tracking 2022-06-07 12:29:53 +02:00
xenmem
xenstore
blkif.h
error.h
evtchn.h
features.c
features.h
gntdev.h
gnttab.h
hvm.h
hypervisor.h
privcmd.h
xen_intr.h
xen_pv.h
xen-os.h