vnc patch queue
Hi,
Flushing the vnc patch queue, with a collection of small bug fixes.
please pull,
Gerd
The following changes since commit eba05e922e8e7f307bc5d4104a78797e55124e97:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-serial-20150519-1' into staging (2015-05-19 14:10:33 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-vnc-20150520-1
for you to fetch changes up to 0ef705a2653f09c15e44a644a98b6febc761431e:
qemu-sockets: Report explicit error if unlink fails (2015-05-20 10:23:08 +0200)
----------------------------------------------------------------
vnc: misc fixes.
----------------------------------------------------------------
Cole Robinson (3):
vnc: Don't assert if opening unix socket fails
vnc: Tweak error when init fails
qemu-sockets: Report explicit error if unlink fails
Daniel P. Berrange (1):
ui: remove check for failure of qemu_acl_init()
Ján Tomko (1):
Strip brackets from vnc host
ui/vnc.c | 23 ++++++++++++----------- util/qemu-sockets.c | 7 ++++++- 2 files changed, 18 insertions(+), 12 deletions(-)
[Qemu-devel] [PULL 3/5] vnc: Don't assert if opening unix socket fails
From: Cole Robinson <[email protected]>
Reproducer:
$ qemu-system-x86_64 -display vnc=unix:/root/i-cant-access-you.sock qemu-system-x86_64: iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed. Aborted (core dumped)
--- ui/vnc.c | 3 +++ 1 file changed, 3 insertions(+)
ui/vnc.c +3 -0
@@ -3684,6 +3684,9 @@ void vnc_display_open(const char *id, Error **errp)/* listen for connects */ if (strncmp (vnc,"unix:" ,5 ) ==0 ) { vs->lsock =unix_listen (vnc+5 ,NULL ,0 , errp); +if (vs->lsock <0 ) { + goto fail; + } vs->is_unix = true; }else { vs->lsock =inet_listen_opts (sopts,5900 , errp);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/5] vnc: Tweak error when init fails
In reply to Gerd HoffmannFrom: Cole Robinson <[email protected]>
Before:
qemu-system-x86_64: -display vnc=unix:/root/foo.sock: Failed to start VNC server on `(null)': Failed to bind socket to /root/foo.sock: Permission denied
After:
qemu-system-x86_64: -display vnc=unix:/root/foo.sock: Failed to start VNC server: Failed to bind socket to /root/foo.sock: Permission denied
Rather than tweak the string possibly show unix: value as well, just drop the explicit display reporting. We already get the cli string in the error message, that should be sufficient.
--- ui/vnc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
ui/vnc.c +1 -2
@@ -3779,8 +3779,7 @@ int vnc_init_func(QemuOpts *opts, void *opaque)vnc_display_init (id);vnc_display_open (id, &local_err);if (local_err !=NULL ) { -error_report ("Failed to start VNC server on `%s': %s" , -qemu_opt_get (opts,"display" ), +error_report ("Failed to start VNC server: %s" ,error_get_pretty (local_err));error_free (local_err);exit (1 );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/5] ui: remove check for failure of qemu_acl_init()
In reply to Gerd HoffmannFrom: "Daniel P. Berrange" <[email protected]>
The qemu_acl_init() function has long since stopped being able to return NULL, since g_malloc will abort on OOM. As such the checks for NULL were unreachable code.
--- ui/vnc.c | 8 -------- 1 file changed, 8 deletions(-)
ui/vnc.c +0 -8
@@ -3609,10 +3609,6 @@ void vnc_display_open(const char *id, Error **errp) aclname = g_strdup_printf("vnc.%s.x509dname", vs->id); } vs->tls.acl =qemu_acl_init (aclname); -if (!vs->tls.acl) { -fprintf (stderr,"Failed to create x509 dname ACL\n" ); -exit (1 ); - }g_free (aclname); }#endif
@@ -3626,10 +3622,6 @@ void vnc_display_open(const char *id, Error **errp) aclname = g_strdup_printf("vnc.%s.username", vs->id); } vs->sasl.acl =qemu_acl_init (aclname); -if (!vs->sasl.acl) { -fprintf (stderr,"Failed to create username ACL\n" ); -exit (1 ); - }g_free (aclname); }#endif
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 5/5] qemu-sockets: Report explicit error if unlink fails
In reply to Gerd HoffmannFrom: Cole Robinson <[email protected]>
Consider this case:
$ ls -ld ~/root-owned/ drwx--x--x. 2 root root 4096 Apr 29 12:55 /home/crobinso/root-owned/ $ ls -l ~/root-owned/foo.sock -rwxrwxrwx. 1 crobinso crobinso 0 Apr 29 12:55 /home/crobinso/root-owned/foo.sock
$ qemu-system-x86_64 -vnc unix:~/root-owned/foo.sock qemu-system-x86_64: -vnc unix:/home/crobinso/root-owned/foo.sock: Failed to start VNC server: Failed to bind socket to /home/crobinso/root-owned/foo.sock: Address already in use
...which is techinically true, but the real error is that we failed to unlink. So report it.
This may seem pathological but it's a real possibility via libvirt.
--- util/qemu-sockets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
util/qemu-sockets.c +6 -1
@@ -729,7 +729,12 @@ int unix_listen_opts(QemuOpts *opts, Error **errp)qemu_opt_set (opts,"path" , un.sun_path, &error_abort); } -unlink (un.sun_path); +if ((access (un.sun_path,F_OK ) ==0 ) && +unlink (un.sun_path) <0 ) { +error_setg_errno (errp, errno, +"Failed to unlink socket %s" , un.sun_path); + goto err; + }if (bind (sock, (struct sockaddr *) &un,sizeof (un)) <0 ) {error_setg_errno (errp, errno,"Failed to bind socket to %s" , un.sun_path); goto err;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 1/5] Strip brackets from vnc host
In reply to Gerd HoffmannFrom: Ján Tomko <[email protected]>
Commit v2.2.0-1530-ge556032 vnc: switch to inet_listen_opts bypassed the use of inet_parse in inet_listen, making literal IPv6 addresses enclosed in brackets fail:
qemu-kvm: -vnc [::1]:0: Failed to start VNC server on `(null)': address resolution failed for [::1]:5900: Name or service not known
Strip the brackets to make it work again.
--- ui/vnc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
ui/vnc.c +8 -1
@@ -3482,7 +3482,14 @@ void vnc_display_open(const char *id, Error **errp) h =strrchr (vnc,':' );if (h) { -char *host =g_strndup (vnc, h - vnc); +char *host; +size_t hlen = h - vnc; + +if (vnc[0 ] =='[' && vnc[hlen -1 ] ==']' ) { + host =g_strndup (vnc +1 , hlen -2 ); + }else { + host =g_strndup (vnc, hlen); + }qemu_opt_set (sopts,"host" , host, &error_abort);qemu_opt_set (wsopts,"host" , host, &error_abort);qemu_opt_set (sopts,"port" , h+1 , &error_abort);
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 14 lines · Gerd Hoffmann
Hi,
Flushing the vnc patch queue, with a collection of small bug fixes.
please pull,
GerdThe following changes since commit
eba05e922e8e7f307bc5d4104a78797e55124e97:Merge remote-tracking branch 'remotes/kraxel/tags/pull-serial-20150519-1' into staging (2015-05-19 14:10:33 +0100)
are available in the git repository at:
Quoted 8 lines
git://git.kraxel.org/qemutags/pull-vnc-20150520-1for you to fetch changes up to
0ef705a2653f09c15e44a644a98b6febc761431e:qemu-sockets: Report explicit error if unlink fails (2015-05-20 10:23:08 +0200)
----------------------------------------------------------------
vnc: misc fixes.
Applied, thanks.
-- PMM