On Thu, Nov 12, 2026 at 11:38:46PM +0100, Simon Lucido wrote:
During postcopy, the vhost-user backend ought to return the base address
at which they mapped regions during SET_MEM_TABLE and ADD_MEM_REG calls
[0]. This was done properly for ADD_MEM_REG, but not for SET_MEM_TABLE,
so any frontend that was relying on that call would not work.
The bug appeared in d288eef3a0a8, which, to silence the
address-of-packed-member warning, created a local copy of vhost message.
That's fine for reading the table, but for postcopy, we also write into
it to send the base addresses back, and after d288eef3a0a8 we ended up
writing into the copy.
This bug was affecting ADD_MEM_REG and SET_MEM_TABLE alike, until
905e8c7e260d fixed the ADD_MEM_REG path by copying back the memory into
the payload.
This commit fixes the SET_MEM_TABLE path by doing exactly that: copying
back the memory table into the payload.
QEMU wasn't affected as it uses ADD_MEM_REG, but any combination of a
frontend that uses SET_MEM_TABLE and libvhost-user backend is.
[0]:
https://gitlab.com/qemu-project/qemu/-/blob/144393da8d4bd307a22525c7feea2bb29a0a7556/docs/interop/vhost-user.rst#L1263
Fixes: d288eef3a0a8 ("libvhost-user: fix -Waddress-of-packed-member")
Signed-off-by: Simon Lucido <[email protected]>
---
Changes in v2:
- Reword the commit message to better explain the original bug
- Link to v1:
https://lists.nongnu.org/archive/html/qemu-devel/2026-11/msg02840.html
---
subprojects/libvhost-user/libvhost-user.c | 1 +
1 file changed, 1 insertion(+)
Reviewed-by: Stefano Garzarella <[email protected]>