vhost-user: Call qemu_socketpair() instead of socketpair()
commit9cbda7b354389e536d546cc2091365bc402b3206
authorGuoyi Tu <tugy@chinatelecom.cn>
Tue, 23 Aug 2022 07:50:40 +0000 (23 15:50 +0800)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 29 Sep 2022 10:38:05 +0000 (29 14:38 +0400)
tree827376839fbdddb4f5171f4350ddc63dbcd5cbe3
parent3c63b4e94a16db730a8185278479b592f7de8b7f
vhost-user: Call qemu_socketpair() instead of socketpair()

As the close-on-exec flags is not set on the file descriptors returned
by socketpair() at default, the fds will survive across exec' function.

In the case that exec' function get invoked, such as the live-update feature
which is been developing, it will cause fd leaks.

To address this problem, we should call qemu_socketpair() to create an pair of
connected sockets with the close-on-exec flag set.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <7002b12a5fb0a30cd878e14e07da61c36da72913.1661240709.git.tugy@chinatelecom.cn>
hw/display/vhost-user-gpu.c
hw/virtio/vhost-user.c