]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_hotplug: Create chardev files before attempting to relabel them
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Jul 2022 14:13:12 +0000 (16:13 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Jul 2022 13:14:44 +0000 (15:14 +0200)
commita1dd3576b57b67c1c562dfb3a33053cc625cfacc
tree8ebbe6423da0bc73fd272179849fbe6cdd323ca0
parent14f42129fce26a00233a172051ed4b5c572e03b1
qemu_hotplug: Create chardev files before attempting to relabel them

When hotplugging a chardev, Libvirt opens corresponding
file/binds to a socket/does whatever necessary to obtain an FD
that is later passed to QEMU. However, due to wrong placement of
the function that does all of this
(qemuProcessPrepareHostBackendChardevHotplug()) it may happen
that a file is set seclabel on, only to be unlink()-ed and
created again (the former is done by
qemuSecuritySetChardevLabel(), the latter by aforementioned
function). The unlink()-ing is done for UNIX sockets with
mode='bind' and happens inside qemuOpenChrChardevUNIXSocket().
However, these steps can be swapped simply.

Fixes: ad81aa8ad07e52c9bd4840de84d2ed59998b4d2a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
src/qemu/qemu_hotplug.c