freebsd-nq/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 xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
xenbus xenbus: improve device tracking 2022-06-07 12:29:53 +02:00
xenmem
xenstore xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
blkif.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
error.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
evtchn.h
features.c
features.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
gntdev.h xen(3): Fix a typo in a source code comment 2022-03-28 19:32:53 +02:00
gnttab.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
hvm.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
hypervisor.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
privcmd.h xen/privcmd: fix MMAP_RESOURCE ioctl to copy out results 2021-11-18 09:46:44 +01:00
xen_intr.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
xen_pv.h
xen-os.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00