qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] vhost-user-test fix
@ 2018-12-15  1:26 Li Qiang
  2018-12-15  1:26 ` [Qemu-devel] [PATCH 1/3] tests: vhost-user-test: initialize 'fd' in chr_read Li Qiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Li Qiang @ 2018-12-15  1:26 UTC (permalink / raw)
  To: thuth, lvivier, pbonzini, mst, peter.maydell, marcandre.lureau,
	berrange, jasowang
  Cc: liq3ea, qemu-devel, Li Qiang

Currently, the vhost-user-test is not correct.
When in qtest mode, the accel is qtest, not kvm.
So when the client side of vhost-user-test send
'VHOST_USER_SET_VRING_CALL' msg, the 'fd' will
no be added in 'fds' in 'vhost_set_vring_file'.
In 'chr_read' of the server side in the 
vhost-user-test, it calls 'qemu_chr_fe_get_msgfds'
to get the fd in 'VHOST_USER_SET_VRING_CALL'. Though
there is no fd returned, but as the 'fd' is not initialized
so 'fd' maybe valid, and 'qemu_set_nonblock' will be success.
Even worse, 'qemu_set_nonblock' doesn't check the return value
of fcntl.

So this cause the interesting bug here: there are three issues,
but they combined and will bypass the qtest.

This patchset tries to address these issue.

Li Qiang (3):
  tests: vhost-user-test: initialize 'fd' in chr_read
  vhost-user: add fds inf 'vhost_set_vring_file' in qtest
  util: check the return value of fcntl in qemu_set_{block, nonblock}

 hw/virtio/vhost-user.c  | 3 ++-
 tests/vhost-user-test.c | 2 +-
 util/oslib-posix.c      | 8 ++++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-15 11:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-15  1:26 [Qemu-devel] [PATCH 0/3] vhost-user-test fix Li Qiang
2018-12-15  1:26 ` [Qemu-devel] [PATCH 1/3] tests: vhost-user-test: initialize 'fd' in chr_read Li Qiang
2018-12-15  1:26 ` [Qemu-devel] [PATCH 2/3] vhost-user: add fds inf 'vhost_set_vring_file' in qtest Li Qiang
2018-12-15 11:08   ` Paolo Bonzini
2018-12-15  1:26 ` [Qemu-devel] [PATCH 3/3] util: check the return value of fcntl in qemu_set_{block, nonblock} Li Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).