vfio queue
The following changes since commit fae886567b48c672977acde6b775dd7e2d2121c1:
Merge tag 'hw-misc-20261130' of https://github.com/philmd/qemu into staging (2026-11-30 14:02:58 -0800)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-vfio-20261201
for you to fetch changes up to a1fbdb9361f11f2cce2a253f3816a6474af155d2:
vfio-user: block migration (2026-12-01 09:36:50 +0100)
----------------------------------------------------------------
vfio queue:
* Fix clang 23 build failures
* Fix a crash in vfio/pci when the host fails to assign a BAR
* Block migration of vfio-user devices
----------------------------------------------------------------
Cédric Le Goater (6):
qemu-vmsr-helper: Actually drop privileges
qemu-keymap: Drop unused ctrl modifier tests/qtest/migration: Drop orphaned tmpfs global tests/unit/test-qtree: Drop unused destroy counters tests/unit/test-rcu-list: Drop unused n_nodes/n_updates counters vfio/pci: Fix crash when BAR has zero size
Oguzhan KAYNAK (1):
vfio-user: block migration
hw/vfio-user/pci.c | 9 +++++++++ hw/vfio/pci.c | 4 +++- qemu-keymap.c | 2 -- tests/qtest/migration/compression-tests.c | 5 ----- tests/unit/test-qtree.c | 4 ---- tests/unit/test-rcu-list.c | 11 ----------- tools/i386/qemu-vmsr-helper.c | 10 ++++++++++ 7 files changed, 22 insertions(+), 23 deletions(-)
[PULL 4/7] tests/unit/test-qtree: Drop unused destroy counters
destroyed_key_count and destroyed_value_count have been incremented in the key and value destroy notifies since the QTree import (commit e3feb2cc224f) but never checked. clang 23 reports them as -Wunused-but-set-global:
../tests/unit/test-qtree.c:42:14: error: variable 'destroyed_key_count' set but not used [-Werror,-Wunused-but-set-global]
42 | static guint destroyed_key_count;
| ^../tests/unit/test-qtree.c:43:14: error: variable 'destroyed_value_count' set but not used [-Werror,-Wunused-but-set-global]
43 | static guint destroyed_value_count;
| ^
2 errors generated.
--- tests/unit/test-qtree.c | 4 ---- 1 file changed, 4 deletions(-)
tests/unit/test-qtree.c +0 -4
@@ -39,19 +39,15 @@ static gint my_search(gconstpointer a, gconstpointer b)static gpointer destroyed_key;static gpointer destroyed_value; -static guint destroyed_key_count; -static guint destroyed_value_count;static void my_key_destroy (gpointer key) { destroyed_key = key; - destroyed_key_count++; }static void my_value_destroy (gpointer value) { destroyed_value = value; - destroyed_value_count++; }static gint my_traverse (gpointer key,gpointer value,gpointer data)
Signature · 1 line
2.56.1
[PULL 1/7] qemu-vmsr-helper: Actually drop privileges
In reply to Cédric Le GoaterThe uid and gid parsed from -u/--user and -g/--group are never used. clang 23 reports them as -Wunused-but-set-global:
../tools/i386/qemu-vmsr-helper.c:59:12: error: variable 'uid' set but not used [-Werror,-Wunused-but-set-global]
59 | static int uid = -1;
| ^../tools/i386/qemu-vmsr-helper.c:60:12: error: variable 'gid' set but not used [-Werror,-Wunused-but-set-global]
60 | static int gid = -1;
| ^
2 errors generated.
The warning hides a real bug: drop_privileges() never calls capng_apply() and never switches to the requested user. Call capng_change_id() before capng_apply() so CAP_SYS_RAWIO survives the uid change.
--- tools/i386/qemu-vmsr-helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/i386/qemu-vmsr-helper.c +10 -0
@@ -323,6 +323,16 @@ static int drop_privileges(void) return -1; } +if (uid !=-1 || gid !=-1 ) { +if (capng_change_id (uid, gid,CAPNG_DROP_SUPP_GRP ) <0 ) { +return -1 ; + } + } + +if (capng_apply (CAPNG_SELECT_BOTH ) !=0 ) { +return -1 ; + } +return 0 ; }#endif
Signature · 1 line
2.56.1
[PULL 6/7] vfio/pci: Fix crash when BAR has zero size
In reply to Cédric Le GoaterWhen the host kernel fails to assign a BAR (broken BIOS "Above 4G Decoding" or ReBAR configuration), the VFIO kernel interface reports a zero size. In that case, vfio_region_setup() skips allocating region->mem, leaving it NULL.
Then, vfio_bar_quirk_setup() calls the BAR quirk probes and passes a NULL region->mem pointer to memory_region_add_subregion_overlap(), causing a segfault in memory_region_update_container_subregions().
Skip quirk setup in vfio_realize() for zero size regions.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2732
--- hw/vfio/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/vfio/pci.c +3 -1
@@ -3658,7 +3658,9 @@ static void vfio_pci_realize(PCIDevice *pdev, Error **errp) }for (i =0 ; i <PCI_ROM_SLOT ; i++) { -vfio_bar_quirk_setup (vdev, i); +if (vdev->bars[i].size) { +vfio_bar_quirk_setup (vdev, i); + } }if (!vfio_pci_interrupt_setup (vdev, errp)) {
Signature · 1 line
2.56.1
[PULL 5/7] tests/unit/test-rcu-list: Drop unused n_nodes/n_updates counters
In reply to Cédric Le Goatern_nodes lost its last user when commit 8a5956ad6392 ("rcu tests: fix compilation on 32-bit ppc") dropped the "val" list member; n_updates was never read. clang 23 reports them as -Wunused-but-set-global:
../tests/unit/test-rcu-list.c:34:18: error: variable 'n_updates' set but not used [-Werror,-Wunused-but-set-global]
34 | static long long n_updates = 0LL;
| ^../tests/unit/test-rcu-list.c:37:18: error: variable 'n_nodes' set but not used [-Werror,-Wunused-but-set-global]
37 | static long long n_nodes = 0LL;
| ^
2 errors generated.
Remove both globals and the local accumulators feeding them.
--- tests/unit/test-rcu-list.c | 11 ----------- 1 file changed, 11 deletions(-)
tests/unit/test-rcu-list.c +0 -11
@@ -31,10 +31,8 @@static QemuMutex counts_mutex;static long long n_reads =0LL ; -static long long n_updates =0LL ;static int64_t n_reclaims;static int64_t n_nodes_removed; -static long long n_nodes =0LL ;static int g_test_in_charge =0 ;static int nthreadsrunning;
@@ -200,8 +198,6 @@ static void *rcu_q_reader(void *arg)static void *rcu_q_updater (void *arg) {int j, target_el; -long long n_nodes_local =0 ; -long long n_updates_local =0 ;long long n_removed_local =0 ;struct list_element *el, *prev_el;
@@ -234,19 +230,15 @@ static void *rcu_q_updater(void *arg) j++;if (target_el == j) { struct list_element *new_el = g_new(struct list_element, 1); - n_nodes_local++;TEST_LIST_INSERT_AFTER_RCU (el, new_el, entry);break ; } } - n_updates_local +=2 ;synchronize_rcu (); }synchronize_rcu ();qemu_mutex_lock (&counts_mutex); - n_nodes += n_nodes_local; - n_updates += n_updates_local;qatomic_set (&n_nodes_removed, n_nodes_removed + n_removed_local);qemu_mutex_unlock (&counts_mutex);return NULL ;
@@ -262,9 +254,6 @@ static void rcu_qtest_init(void) new_el = g_new(struct list_element, 1);TEST_LIST_INSERT_HEAD_RCU (&Q_list_head, new_el, entry); } -qemu_mutex_lock (&counts_mutex); - n_nodes +=RCU_Q_LEN ; -qemu_mutex_unlock (&counts_mutex); }static void rcu_qtest_run (int duration,int nreaders)
Signature · 1 line
2.56.1
[PULL 3/7] tests/qtest/migration: Drop orphaned tmpfs global
In reply to Cédric Le Goatertmpfs has no users left since the unix migration tests derive the socket path from MigrationTestEnv (commit 718b9e4eb6bc and friends). clang 23 reports the leftover as -Wunused-but-set-global:
../tests/qtest/migration/compression-tests.c:21:14: error: variable 'tmpfs' set but not used [-Werror,-Wunused-but-set-global]
21 | static char *tmpfs;
| ^
1 error generated.
Remove the leftover global.
--- tests/qtest/migration/compression-tests.c | 5 ----- 1 file changed, 5 deletions(-)
tests/qtest/migration/compression-tests.c +0 -5
@@ -17,9 +17,6 @@#include "migration/migration-util.h" #include "qemu/module.h" - -static char *tmpfs; -static void set_multifd_compression (QTestState *from,QTestState *to,const char *method) {
@@ -174,8 +171,6 @@ static void migration_test_add_compression_smoke(MigrationTestEnv *env)void migration_test_add_compression (MigrationTestEnv *env) { - tmpfs = env->tmpfs; -migration_test_add_compression_smoke (env);if (!env->full_set) {
Signature · 1 line
2.56.1
[PULL 7/7] vfio-user: block migration
In reply to Cédric Le GoaterFrom: Oguzhan KAYNAK <[email protected]>
vfio-user devices lack a migration blocker, so migration can complete successfully without transferring device state. The destination VM is left with an unconfigured device, for example with its BARs unassigned, and -only-migratable does not reject such a device.
Block migration until vfio-user migration support is implemented. Block all migration modes because vfio-user does not support CPR either.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/5002
--- hw/vfio-user/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/vfio-user/pci.c +9 -0
@@ -11,6 +11,7 @@#include "qapi/qapi-type-infos-sockets.h" #include "qapi-visit-sockets.h" #include "qemu/error-report.h" +#include "migration/blocker.h" #include "hw/core/qdev-properties.h" #include "hw/vfio/pci.h"
@@ -284,6 +285,13 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)return ; } vbasedev->proxy = proxy; + +error_setg (&vbasedev->migration_blocker, +"%s: migration is not supported" , vbasedev->name); +if (migrate_add_blocker (&vbasedev->migration_blocker, errp) <0 ) { + goto error; + } +vfio_user_set_handler (vbasedev, vfio_user_pci_process_req, vdev);if (udev->send_queued) {
@@ -358,6 +366,7 @@ out_teardown:vfio_pci_teardown_msi (vdev);vfio_pci_bars_exit (vdev); error: +migrate_del_blocker (&vbasedev->migration_blocker);error_prepend (errp,VFIO_MSG_PREFIX , vdev->vbasedev.name);vfio_pci_put_device (vdev); }
Signature · 1 line
2.56.1
[PULL 2/7] qemu-keymap: Drop unused ctrl modifier
In reply to Cédric Le GoaterThe ctrl modifier mask has been set but never read since the tool was added in commit 6a021536e239 ("tools: add qemu-keymap"). This went unnoticed until clang 23 extended -Wunused-but-set-variable to file scope statics as -Wunused-but-set-global:
../qemu-keymap.c:28:23: error: variable 'ctrl' set but not used [-Werror,-Wunused-but-set-global]
28 | static xkb_mod_mask_t ctrl;
| ^
1 error generated.
Remove the dead variable.
--- qemu-keymap.c | 2 -- 1 file changed, 2 deletions(-)
qemu-keymap.c +0 -2
@@ -25,7 +25,6 @@ struct xkb_rule_names names = { };static xkb_mod_mask_t shift; -static xkb_mod_mask_t ctrl;static xkb_mod_mask_t altgr;static xkb_mod_mask_t numlock;
@@ -227,7 +226,6 @@ int main(int argc, char *argv[]) } shift =get_mod (map,"Shift" ); - ctrl =get_mod (map,"Control" ); altgr =get_mod (map,"AltGr" );if (!altgr) { altgr =get_mod (map,"Mod5" );
Signature · 1 line
2.56.1
Richard Henderson
AppliedQuoted 10 lines · Cédric Le Goater
The following changes since commit
fae886567b48c672977acde6b775dd7e2d2121c1:Merge tag 'hw-misc-20261130' ofhttps://github.com/philmd/qemu into staging (2026-11-30 14:02:58 -0800)are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-vfio-20261201for you to fetch changes up to
a1fbdb9361f11f2cce2a253f3816a6474af155d2:
Quoted 8 lines
vfio-user: block migration (2026-12-01 09:36:50 +0100)----------------------------------------------------------------
vfio queue:* Fix clang 23 build failures
* Fix a crash in vfio/pci when the host fails to assign a BAR
* Block migration of vfio-user devices
Applied, thanks.
r~