[PATCH 00/27] qemu: Fix chardev hot(un)plug issues and sanitize use of /dev/fdset/N

Peter Krempa posted 27 patches 2 years, 2 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1644422238.git.pkrempa@redhat.com
po/POTFILES.in                                |   1 +
scripts/mock-noinline.py                      |   2 +-
src/qemu/meson.build                          |   1 +
src/qemu/qemu_command.c                       | 260 +++++----------
src/qemu/qemu_command.h                       |   4 +-
src/qemu/qemu_domain.c                        |  94 +++---
src/qemu/qemu_domain.h                        |  13 +-
src/qemu/qemu_driver.c                        |   3 +-
src/qemu/qemu_fd.c                            | 296 ++++++++++++++++++
src/qemu/qemu_fd.h                            |  56 ++++
src/qemu/qemu_hotplug.c                       | 100 ++++--
src/qemu/qemu_hotplug.h                       |   2 +-
src/qemu/qemu_monitor.c                       |  14 +-
src/qemu/qemu_monitor.h                       |   4 +-
src/qemu/qemu_monitor_json.c                  |  82 +++--
src/qemu/qemu_monitor_json.h                  |   2 +-
src/qemu/qemu_process.c                       | 102 ++++--
src/qemu/qemu_process.h                       |   6 +
src/util/virtpm.c                             |  13 +-
tests/qemuhotplugmock.c                       |  11 +
tests/qemuhotplugtest.c                       |   6 +-
tests/qemumonitorjsontest.c                   | 253 +++++++++------
.../qemuxml2argvdata/aarch64-pci-serial.args  |   3 +-
.../name-escape.x86_64-2.11.0.args            |   3 +-
.../name-escape.x86_64-latest.args            |   4 +-
.../net-vdpa.x86_64-latest.args               |   4 +-
.../qemuxml2argvdata/serial-file-chardev.args |   3 +-
.../serial-file-chardev.x86_64-latest.args    |   4 +-
tests/qemuxml2argvdata/serial-file-log.args   |   4 +-
.../serial-file-log.x86_64-latest.args        |   6 +-
.../qemuxml2argvdata/serial-many-chardev.args |   3 +-
.../serial-many-chardev.x86_64-latest.args    |   4 +-
.../tpm-passthrough-crb.x86_64-latest.args    |   6 +-
.../tpm-passthrough.x86_64-latest.args        |   6 +-
tests/qemuxml2argvmock.c                      |   1 -
tests/qemuxml2argvtest.c                      |  87 +----
tests/testutilsqemu.c                         | 106 +++++++
tests/testutilsqemu.h                         |   3 +
38 files changed, 1011 insertions(+), 561 deletions(-)
create mode 100644 src/qemu/qemu_fd.c
create mode 100644 src/qemu/qemu_fd.h
[PATCH 00/27] qemu: Fix chardev hot(un)plug issues and sanitize use of /dev/fdset/N
Posted by Peter Krempa 2 years, 2 months ago
This series addresses the following issues:

- hot-unplug of chardevs leaks the FDset in qemu
- hot-plug of chardev doesn't use virtlogd even when configured
- the name of the FD used for vdpa doesn't really tie it to the device

There's also improvement in the common code handling the FD passing and
few other drive-by fixes.

Peter Krempa (27):
  scripts/moc-noinline: Use full name of the required annotation in
    error message
  qemuProcessPrepareHostBackendChardevFileHelper: Always use FD passing
  qemuProcessPrepareHostBackendChardev: Drop unneeded arguments
  qemuMonitorJSONQueryFdsetsParse: Don't check value passed to g_strdup
  qemuMonitorRemoveFdset: Convert @fdset to unsigned int to avoid error
  qemu: monitor: Make 'id' in 'struct _qemuMonitorFdsetInfo' unsigned
  qemu: domain: Move and unexport 'qemuDomainStorageIdReset'
  qemu: domain: Add helper for generating 'fdset' ids for VM startup
  qemu: Introduce helper functions for passing FDs to qemu
  qemuBuildInterfaceCommandLine: Use qemuFDPass for the vdpa fd
  qemu: hotplug: Extract code for unplugging fdsets
  qemuHotplugRemoveFDSet: Prepare for proper FD unplug handling
  qemuBuildInterfaceCommandLine: Use new pattern for naming the VDPA
    fdset
  qemu: Rewrite chardev startup code to use qemuFDPass
  qemuDomainRemoveChrDevice: Detach fdset after chardev hot-unplug
  qemumonitorjsontest: chardev: Remove need to allow unused commands
  qemumonitorjsontest: Refactor chardev hotplug testing
  qemuMonitorJSONTestAttachChardev: Add test for TLS-secured TCP chardev
  qemuMonitorJSONTestAttachChardev: Add logfile to some tests
  qemuMonitorJSONAttachCharDevGetProps: Properly handle private data
  tests: Move testPrepareHostBackendChardevOne into test utils
  qemuMonitorJSONTestAttachChardev: Add tests for FD passing of file
    backend
  qemu: process: Add a hotplug version of
    qemuProcessPrepareHostBackendChardev
  qemu: Honour 'virtlogd' use when hotplugging chardevs
  virTPMCreateCancelPath: Refactor value returning
  qemuBuildTPMOpenBackendFDs: Construct 'cancel_path' internally
  qemuBuildTPMCommandLine: Use 'qemuPassFD' infrastructure

 po/POTFILES.in                                |   1 +
 scripts/mock-noinline.py                      |   2 +-
 src/qemu/meson.build                          |   1 +
 src/qemu/qemu_command.c                       | 260 +++++----------
 src/qemu/qemu_command.h                       |   4 +-
 src/qemu/qemu_domain.c                        |  94 +++---
 src/qemu/qemu_domain.h                        |  13 +-
 src/qemu/qemu_driver.c                        |   3 +-
 src/qemu/qemu_fd.c                            | 296 ++++++++++++++++++
 src/qemu/qemu_fd.h                            |  56 ++++
 src/qemu/qemu_hotplug.c                       | 100 ++++--
 src/qemu/qemu_hotplug.h                       |   2 +-
 src/qemu/qemu_monitor.c                       |  14 +-
 src/qemu/qemu_monitor.h                       |   4 +-
 src/qemu/qemu_monitor_json.c                  |  82 +++--
 src/qemu/qemu_monitor_json.h                  |   2 +-
 src/qemu/qemu_process.c                       | 102 ++++--
 src/qemu/qemu_process.h                       |   6 +
 src/util/virtpm.c                             |  13 +-
 tests/qemuhotplugmock.c                       |  11 +
 tests/qemuhotplugtest.c                       |   6 +-
 tests/qemumonitorjsontest.c                   | 253 +++++++++------
 .../qemuxml2argvdata/aarch64-pci-serial.args  |   3 +-
 .../name-escape.x86_64-2.11.0.args            |   3 +-
 .../name-escape.x86_64-latest.args            |   4 +-
 .../net-vdpa.x86_64-latest.args               |   4 +-
 .../qemuxml2argvdata/serial-file-chardev.args |   3 +-
 .../serial-file-chardev.x86_64-latest.args    |   4 +-
 tests/qemuxml2argvdata/serial-file-log.args   |   4 +-
 .../serial-file-log.x86_64-latest.args        |   6 +-
 .../qemuxml2argvdata/serial-many-chardev.args |   3 +-
 .../serial-many-chardev.x86_64-latest.args    |   4 +-
 .../tpm-passthrough-crb.x86_64-latest.args    |   6 +-
 .../tpm-passthrough.x86_64-latest.args        |   6 +-
 tests/qemuxml2argvmock.c                      |   1 -
 tests/qemuxml2argvtest.c                      |  87 +----
 tests/testutilsqemu.c                         | 106 +++++++
 tests/testutilsqemu.h                         |   3 +
 38 files changed, 1011 insertions(+), 561 deletions(-)
 create mode 100644 src/qemu/qemu_fd.c
 create mode 100644 src/qemu/qemu_fd.h

-- 
2.34.1