Skip to content

Fix pointer arithmetic in indirect read for libvhost-user and libvduse

Temir Zharaspayev qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2libvhost-user: Fix pointer arithmetic in indirect readsubprojects/libvhost-user/libvhost-user.c+6 -52 replies
2/2libvduse: Fix pointer arithmetic in indirect readsubprojects/libvduse/libvduse.c+6 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Fix pointer arithmetic in indirect read for libvhost-user and libvduse

Hello! I have found a problem with virtqueue_read_indirect_desc function, which was advancing pointer to struct as it was a byte pointer, so every element comming after first chunk would be copied somewhere out of buffer.

As I understand this is cold path, but nevertheless worth fixing.

Also, exacly same problem in vduse_queue_read_indirect_desc function, because as I understand it is a copy of virtqueue_read_indirect_desc with vduse backend.

I was not sure if element of scattered buffer may end in the middle of vring_desc struct data, so instead of writing
desc += read_len/sizeof(struct vring_desc)
have implemented fix with proper byte pointer arithmetic.

Sincerely,
Temir.

Temir Zharaspayev (2):
libvhost-user: Fix pointer arithmetic in indirect read
libvduse: Fix pointer arithmetic in indirect read

 subprojects/libvduse/libvduse.c           | 11 ++++++-----
 subprojects/libvhost-user/libvhost-user.c | 11 ++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1