Bug 1159731

Summary: virt-viewer crashed when connect a guest with vnc graphics and wrong password input
Product: Red Hat Enterprise Linux 7 Reporter: zhoujunqin <juzhou>
Component: virt-viewerAssignee: Virt Viewer Maint <virt-viewer-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.1CC: codong, dblechte, dyuan, fidencio, jjongsma, rbalakri, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-viewer-0.6.0-11.el7 Doc Type: Bug Fix
Doc Text:
Cause: When the authentication failed asking if the user would like to try to reconnect and the user clicks 'yes; , because the connection was disconnected, all windows are closed/cleaned up. Then when virt-viewer tries to reconnect again it ends up in a place where there is no display set. Consequence: As there is no display set, virt-viewer crashes trying to reconnect. Fix: Re-use the existing display/window when trying to re-authenticate. Result: When the user inserts a wrong password and re-try to connect, the authentication dialog is re-shown without any crash.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:40:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
detail debug info for virt-viewer none

Description zhoujunqin 2014-11-03 08:05:51 UTC
Created attachment 953020 [details]
detail debug info for virt-viewer

Description of problem:
virt-viewer crashed when connect a guest with vnc graphics and wrong password input

Version-Release number of selected component (if applicable):
virt-manager-1.1.0-5.el7.noarch
virt-viewer-0.6.0-10.el7.x86_64
virt-viewer-debuginfo-0.6.0-10.el7.x86_64
libvirt-1.2.8-5.el7.x86_64
gtk2-immodule-xim-2.24.22-6.el7.x86_64
gtk3-3.8.8-9.el7.x86_64
gtk-vnc2-0.5.2-7.el7.x86_64
gtkmm30-3.8.1-3.el7.x86_64
gtksourceview3-3.8.1-4.el7.x86_64
gtk3-immodule-xim-3.8.8-9.el7.x86_64
gtkmm24-2.24.2-8.el7.x86_64
gtk2-2.24.22-6.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Prepare a guest with vnc display and password set.
# virt-manager
Click "Details-> Display vnc -> Check on option Password -> input password : ccdd -> Click Apply".

# virsh dumpxml rhel6.5 --security-info
...
    <graphics type='vnc' port='5901' autoport='yes' listen='0.0.0.0' passwd='ccdd'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
...

2. Start guest.
# virsh start rhel6.5

3. Use virt-viewer to connect the guest, a dialogue let you input the password showed, then input a wrong password, such as "abcd".
   Then it will show: Authentication failed.
   Retry connection again? NO/YES
4. Repeat step3 times with wrong password and click "YES" to retry.


Actual results:
After tring with wrong password two times, virt-viewer crashed.
# virt-viewer  rhel6.5

** (virt-viewer:26113): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-sfl9ZxDkb0: Connection refused

(virt-viewer:26113): virt-viewer-CRITICAL **: ensure_window_for_display: assertion 'l != NULL' failed
Segmentation fault (core dumped)

Expected results:
virt-viewer should not crash when inputting wrong password several times.

Additional info:
1. I will attach detail debug info.
2. coredump file:

# gdb core.26868
(gdb) where
#0  0x000000000041c9d9 in virt_viewer_window_get_notebook (self=0x0)
    at virt-viewer-window.c:1157
#1  0x0000000000413666 in display_show_hint (display=<optimized out>,
    pspec=<optimized out>, user_data=<optimized out>) at virt-viewer-app.c:923
#2  0x00007ff60212dfd8 in g_closure_invoke () from /lib64/libgobject-2.0.so.0
#3  0x00007ff6021400ad in signal_emit_unlocked_R () from /lib64/libgobject-2.0.so.0
#4  0x00007ff602147e32 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
#5  0x00007ff6021480ef in g_signal_emit () from /lib64/libgobject-2.0.so.0
#6  0x00007ff602132675 in g_object_dispatch_properties_changed ()
   from /lib64/libgobject-2.0.so.0
#7  0x00007ff602134d59 in g_object_notify () from /lib64/libgobject-2.0.so.0
#8  0x0000000000411e5e in virt_viewer_app_display_added (session=<optimized out>,
    display=0x268cce0, self=0x266e140) at virt-viewer-app.c:950
#9  0x00007ff6021312db in g_cclosure_marshal_VOID__OBJECTv ()
   from /lib64/libgobject-2.0.so.0
#10 0x00007ff60212e207 in _g_closure_invoke_va () from /lib64/libgobject-2.0.so.0
#11 0x00007ff602147487 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
#12 0x00007ff602148638 in g_signal_emit_by_name () from /lib64/libgobject-2.0.so.0
#13 0x00000000004185ce in virt_viewer_session_add_display (session=0x26518c0,
    display=0x268cce0) at virt-viewer-session.c:444
#14 0x00007ff60212e207 in _g_closure_invoke_va () from /lib64/libgobject-2.0.so.0
#15 0x00007ff602147487 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
#16 0x00007ff6021480ef in g_signal_emit () from /lib64/libgobject-2.0.so.0
#17 0x00007ff60574e5b5 in on_connected () from /lib64/libgtk-vnc-2.0.so.0
#18 0x00007ff60212e207 in _g_closure_invoke_va () from /lib64/libgobject-2.0.so.0
#19 0x00007ff602147487 in g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
#20 0x00007ff6021480ef in g_signal_emit () from /lib64/libgobject-2.0.so.0
#21 0x00007ff605531735 in do_vnc_connection_emit_main_context ()
   from /lib64/libgvnc-1.0.so.0
#22 0x00007ff601e349ba in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#23 0x00007ff601e34d08 in g_main_context_iterate.isra.24 ()
   from /lib64/libglib-2.0.so.0
#24 0x00007ff601e34fda in g_main_loop_run () from /lib64/libglib-2.0.so.0
#25 0x00007ff603be013d in gtk_main () from /lib64/libgtk-3.so.0
#26 0x000000000040fc1a in main (argc=1, argv=0x7fffcd6fd0a8)
    at virt-viewer-main.c:116

Comment 2 Fabiano Fidêncio 2014-11-03 10:43:26 UTC
Already fixed upstream and will be fixed in the next build.
The commits to be backported are:
dce19b379ad65a0d0edef6dfce19f1177eb082c6
ed9b3f3450832c0b17b80468748aff4bddfcec34
51c3a0decf21e9cfc200e20ad6635f39262efdf9

Comment 4 CongDong 2014-11-06 06:41:53 UTC
I can reproduce this with: virt-viewer-0.6.0-10.el7.x86_64

Verify with:
virt-viewer-0.6.0-11.el7.x86_64

Steps:

1. Prepare a vnc guest and set the graphics password "ccdd":
# virsh dumpxml vm1
...
    <graphics type='vnc' port='5901' autoport='yes' listen='0.0.0.0' passwd='ccdd'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
...
2. # virsh start vm1
3. # virt-viewer vm1
After the password dialog comes out, input a wrong password and click "YES" to input again.
4. Repeat 3 several times(10)
5. input right password

Result:
Step4, no core dump
Step5, virt-viewer can connect the guest.

Also test via ssh, no core dump.

As the result, move to VERIFIED.

Comment 6 errata-xmlrpc 2015-03-05 13:40:15 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://rhn.redhat.com/errata/RHBA-2015-0295.html