Bug 1665896 - VNC unix listener socket is deleted after first client quits
Summary: VNC unix listener socket is deleted after first client quits
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: Daniel Berrangé
QA Contact: Guo, Zhiyi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-14 11:45 UTC by Daniel Berrangé
Modified: 2019-11-12 00:10 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-3.1.0-12.module+el8+2778+279c3c9e
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-29 16:04:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1795100 0 None None None 2019-01-14 11:45:51 UTC
Red Hat Product Errata RHBA-2019:1293 0 None None None 2019-05-29 16:05:20 UTC

Description Daniel Berrangé 2019-01-14 11:45:12 UTC
Description of problem:
If QEMU is set to listen on a UNIX socket:

   qemu-kvm -vnc unix:vnc.sock

then connect with a client, disconnect & then try to connect again, the second connection will fail as the socket no longer exists

    $ ls vnc.sock
    vnc.sock
    $ socat STDIO UNIX-CONNECT:vnc.sock <<<''
    RFB 003.008
    $ ls vnc.sock
    ls: cannot access 'vnc.sock': No such file or directory
    $ socat STDIO UNIX-CONNECT:vnc.sock <<<''
    2019/01/14 11:42:04 socat[24546] E connect(5, AF=1 "vnc.sock", 10): No such file or directory

This is a regression in QEMU 3.0.0, as the qio_channel_socket_close method mistakenly deletes the server socket.

Version-Release number of selected component (if applicable):
qemu-kvm-3.1.0-4.module+el8+2681+819ab34d

How reproducible:
Always

Steps to Reproduce:
1.   qemu-kvm -vnc unix:vnc.sock
2. socat STDIO UNIX-CONNECT:vnc.sock <<<''
3. socat STDIO UNIX-CONNECT:vnc.sock <<<''

Actual results:
    $ socat STDIO UNIX-CONNECT:vnc.sock <<<''
    2019/01/14 11:42:04 socat[24546] E connect(5, AF=1 "vnc.sock", 10): No such file or directory

Expected results:
    $ socat STDIO UNIX-CONNECT:vnc.sock <<<''
    RFB 003.008

Comment 1 Rick Barry 2019-01-14 21:14:12 UTC
I left ITR as backlog ('---') and set priority to 'medium' since it was undefined (but I may have underestimated that). Please review and adjust as needed.

Comment 3 Daniel Berrangé 2019-01-25 10:37:09 UTC
Merged upstream in

commit 73564c407caedf992a1c688b5fea776a8b56ba2a
Author: Daniel P. Berrangé <berrange>
Date:   Mon Jan 14 11:33:18 2019 +0000

    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 <mail>
      Date:   Mon May 21 19:17:35 2018 +0300
    
        Delete AF_UNIX socket after close
    
    Fixes launchpad #1795100
    
    Reviewed-by: Eric Blake <eblake>
    Signed-off-by: Daniel P. Berrangé <berrange>

Comment 8 Danilo de Paula 2019-02-08 13:20:22 UTC
Fix included in qemu-kvm-3.1.0-12.module+el8+2778+279c3c9e

Comment 16 errata-xmlrpc 2019-05-29 16:04:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:1293


Note You need to log in before you can comment on or make changes to this bug.