Hi,
I found the issue by chance, while working in not-yet-upstreamed virtio code. I am not sure if there is any QEMU stub currently
upstreamed that does not support an F_CONFIG backend, to be able to trigger the error. It may as well be that this branch
of the condition is never executed.
Nonetheless, the segfault can be triggered using the tests/qtest/vhost-user-test, e.g., with the virtio-gpio device.
We can force the QEMU side to go into the else part of the supports_f_config by applying this patch:
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index fe3da32c74..23634e74ce 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -226,8 +226,8 @@ static int vu_gpio_connect(DeviceState *dev, Error **errp)
}
gpio->connected = true;
- vhost_dev_set_config_notifier(vhost_dev, &gpio_ops);
- gpio->vhost_user.supports_config = true;
+ //vhost_dev_set_config_notifier(vhost_dev, &gpio_ops);
+ gpio->vhost_user.supports_config = false;
ret = vhost_dev_init(vhost_dev, &gpio->vhost_user,
VHOST_BACKEND_TYPE_USER, 0, errp);
Without the patch the test would cause the segfault. Otherwise, it prints the warning and fails afterwards.
I couldn't find a good way to properly cover this in a test, but I can try, and add it to this patch if anyone has a suggestion.
BR,
Albert Esteve