Files
cloud-hypervisor/vmm
Max Makarov cdfedfaab2 vmm: device_manager: reject duplicate socket in add_user_device
Calling vm.add-user-device a second time with a socket path already
in use makes the VMM thread block indefinitely inside
vfio_user::Client::new(). libvfio-user servers (SPDK, the reference
libvfio-user daemon) accept a single active client per socket, so
the second connect(2) succeeds at the OS level but the handshake
recvmsg(2) waits for a response that never arrives.

All subsequent API requests queue behind the stuck VMM event loop
and also hang (vm.info, vmm.ping, vm.remove-device). The VM itself
keeps running on vcpu threads, making the symptom confusing: the
guest looks healthy, only the API is unreachable.

This is easy to hit from management software that uses an idempotent
reconcile / ensure pattern for user devices.

Reject the call up-front when another user_device already has the
same socket path, returning an HTTP 500 with a descriptive
UserDeviceSocketInUse error in milliseconds instead of hanging.

Signed-off-by: Max Makarov <maxpain@linux.com>
2026-04-16 22:04:38 +00:00
..