Skip to content

RFC Accept passed in socket 'fd' open from outside for unix socket

Wei Xu qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3chardev: add new socket fd parameter for unix socketqapi-schema.json qemu-char.c+5 -15 replies
2/3chardev: save the passed in 'fd' parameter during parsingqemu-char.c+7 -00 replies
3/3sockets: replace creating a new socket with the record oneutil/qemu-sockets.c+17 -80 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [Qemu-devel] [RFC Patch 0/3] Accept passed in socket 'fd' open from outside for unix socket

There has been comments on this patch, but i forgot adding this patch to the list, just forward it again.

Recently I'm working on a fd passing issue, selinux forbids qemu to create a unix socket for a chardev when managing VMs with libvirt, because qemu don't have sufficient permissions in this case, and proposal from libvirt team is opening the 'fd' in libvirt and merely passing it to qemu.

I finished a RFC patch for Unix socket after a glance of the code, and not sure if this is right or there maybe other side-effects, please point me out.

I tested it for both server and client mode 'PF_UNIX' socket with a VM running vhost-user.

Old command line:
-chardev socket,id=char0,path=/var/run/openvswitch/vhost-user1,server

New command line:
-chardev socket,id=char0,path=/var/run/openvswitch/vhost-user1,server,sockfd=$n

because unix socket is bundled with a path, so it should be kept even with the 'fd' is indicated, this looks odd, any comments?

Wei Xu (3):
chardev: add new socket fd parameter for unix socket
chardev: save the passed in 'fd' parameter during parsing
sockets: replace creating a new socket with the record one

 qapi-schema.json    |  3 ++-
 qemu-char.c         | 10 ++++++++++
 util/qemu-sockets.c | 25 +++++++++++++++++--------
 3 files changed, 29 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.1