@@ -317,7 +317,8 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,
&offset);
fd = memory_region_get_fd(mr);
if (fd > 0) {
- msg.payload.memory.regions[fd_num].user_addr = reg->userspace_addr;
+ /* Use GPA as user address not to leak QEMU VAs to the backend */
+ msg.payload.memory.regions[fd_num].user_addr = reg->guest_phys_addr;
msg.payload.memory.regions[fd_num].memory_size = reg->memory_size;
msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
msg.payload.memory.regions[fd_num].mmap_offset = offset;
@@ -924,7 +925,7 @@ static void vhost_user_set_iotlb_callback(struct vhost_dev *dev, int enabled)
const VhostOps user_ops = {
.backend_type = VHOST_BACKEND_TYPE_USER,
- .uaddr_type = VHOST_UADDR_TYPE_HVA,
+ .uaddr_type = VHOST_UADDR_TYPE_GPA,
.vhost_backend_init = vhost_user_init,
.vhost_backend_cleanup = vhost_user_cleanup,
.vhost_backend_memslots_limit = vhost_user_memslots_limit,
The user backends use user address from VHOST_USER_SET_MEM_TABLE to be able to handle VHOST_USER_SET_VRING_ADDR and VHOST_USER_IOTLB_MSG payloads. Now that Vhost code supports the use of Guest physical addresses instead of QEMU process virtual addresses, let's do the switch to avoid leaking QEMU process VAs to the user backend. Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> --- hw/virtio/vhost-user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)