Skip to contentSkip to conversation

Qio next patches

GIT PULL Applied Daniel P. Berrangé 2 participants 3 messages Jan 24, 2019 – Jan 25, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 6d809e7da943bb4b95b408fbf3d80d097c0f7d38:

Merge remote-tracking branch 'remotes/xtensa/tags/20190122-xtensa' into staging (2019-01-23 21:50:49 +0000)

are available in the Git repository at:

https://github.com/berrange/qemu tags/qio-next-pull-request

for you to fetch changes up to 73564c407caedf992a1c688b5fea776a8b56ba2a:

io: ensure UNIX client doesn't unlink server socket (2019-01-24 12:23:35 +0000)

----------------------------------------------------------------
Merge qio 2019/01/24

Fixes accidental deletion of VNC server UNIX listener socket

----------------------------------------------------------------

Daniel P. Berrangé (1):
io: ensure UNIX client doesn't unlink server socket

 io/channel-socket.c            | 19 ++------
 tests/test-io-channel-socket.c | 86 ++++++++++++++++++++++++++++++----
 2 files changed, 80 insertions(+), 25 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

[Qemu-devel] [PULL 1/1] io: ensure UNIX client doesn't unlink server socket

The qio_channel_socket_close method for was mistakenly unlinking the UNIX server socket, even if the channel was a client connection. This was not noticed with chardevs, since they never call close, but with the VNC server, this caused the VNC server socket to be deleted after the first client quit.

The qio_channel_socket_close method also needlessly reimplemented the logic that already exists in socket_listen_cleanup(). Just call that method directly, for listen sockets only.

This fixes a regression introduced in QEMU 3.0.0 with

commit d66f78e1eaa832f73c771d9df1b606fe75d52a50
Author: Pavel Balaev <[email protected]>
Date: Mon May 21 19:17:35 2018 +0300

Delete AF_UNIX socket after close

Fixes launchpad #1795100

---
 io/channel-socket.c            | 19 ++------
 tests/test-io-channel-socket.c | 86 ++++++++++++++++++++++++++++++----
 2 files changed, 80 insertions(+), 25 deletions(-)
io/channel-socket.c +4 -15
index b50e63a053..bc5f80e780 100644
@@ -688,10 +688,13 @@ qio_channel_socket_close(QIOChannel *ioc,
     int rc = 0;
 
     if (sioc->fd != -1) {
-        SocketAddress *addr = socket_local_address(sioc->fd, errp);
 #ifdef WIN32
         WSAEventSelect(sioc->fd, NULL, 0);
 #endif
+        if (qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN)) {
+            socket_listen_cleanup(sioc->fd, errp);
+        }
+
         if (closesocket(sioc->fd) < 0) {
             sioc->fd = -1;
             error_setg_errno(errp, errno,
@@ -699,20 +702,6 @@ qio_channel_socket_close(QIOChannel *ioc,
             return -1;
         }
         sioc->fd = -1;
-
-        if (addr && addr->type == SOCKET_ADDRESS_TYPE_UNIX
-            && addr->u.q_unix.path) {
-            if (unlink(addr->u.q_unix.path) < 0 && errno != ENOENT) {
-                error_setg_errno(errp, errno,
-                                 "Failed to unlink socket %s",
-                                 addr->u.q_unix.path);
-                rc = -1;
-            }
-        }
-
-        if (addr) {
-            qapi_free_SocketAddress(addr);
-        }
     }
     return rc;
 }
tests/test-io-channel-socket.c +76 -10

189 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw
In reply to Daniel P. Berrangé
Quoted 11 lines · Daniel P. Berrangé

The following changes since commit 6d809e7da943bb4b95b408fbf3d80d097c0f7d38:

Merge remote-tracking branch 'remotes/xtensa/tags/20190122-xtensa' into staging (2019-01-23 21:50:49 +0000)

are available in the Git repository at:

https://github.com/berrange/qemu tags/qio-next-pull-request

for you to fetch changes up to 73564c407caedf992a1c688b5fea776a8b56ba2a:

Quoted 8 lines

io: ensure UNIX client doesn't unlink server socket (2019-01-24 12:23:35 +0000)

----------------------------------------------------------------
Merge qio 2019/01/24

Fixes accidental deletion of VNC server UNIX listener socket

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM