RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 710461 - segfault on client after locking/unlocking KDE session
Summary: segfault on client after locking/unlocking KDE session
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: spice-client
Version: 6.1
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Christophe Fergeau
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-03 13:16 UTC by Lubos Kocman
Modified: 2011-12-06 15:22 UTC (History)
6 users (show)

Fixed In Version: spice-client-0.8.2-1.el6
Doc Type: Bug Fix
Doc Text:
Cause Double free of a pointer (data of X-selection -- see comment 7). Consequence After locking/unlocking client screen, spice-client crashed (segfault). Fix Free this pointer only once Result After locking/unlocking client screen, spice-client does not crash.
Clone Of:
Environment:
Last Closed: 2011-12-06 15:22:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
thread apply all bt (12.18 KB, text/plain)
2011-06-03 13:16 UTC, Lubos Kocman
no flags Details
spicec log (7.28 KB, text/plain)
2011-06-03 13:18 UTC, Lubos Kocman
no flags Details
proposed patch (1.35 KB, patch)
2011-07-07 14:21 UTC, Christophe Fergeau
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1518 0 normal SHIPPED_LIVE libcacard and spice-client bug fix and enhancement update 2011-12-06 00:50:43 UTC

Description Lubos Kocman 2011-06-03 13:16:32 UTC
Created attachment 502808 [details]
thread apply all bt

Description of problem:

spiceclient got segfault after locking/unlocking gnome session

Version-Release number of selected component (if applicable):

# rhel61x64 client/host 
spice-client-0.8.0-2.el6.x86_64
qemu-kvm-0.12.1.2-2.162.el6.x86_64
glibc-2.12-1.26.el6.x86_64
# rhel61x64 guest
spice-vdagent-0.6.3-8.el6.x86_64
xorg-x11-drv-qxl-0.0.12-9.el6.x86_64

How reproducible:

always on my setup with these options


Steps to Reproduce:
1. /usr/libexec/qemu-kvm -m 768 -device qxl -device qxl -device qxl -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=4003,disable-ticketing,image-compression=glz,streaming-video=on,playback-compression=on -soundhw ac97 -boot dcn -vga qxl /dev/rootvg/gst-rhel6x64 -device qxl -cdrom /home/lkocman/Downloads/RHEV-toolsSetup_2.3_395.iso -redir tcp:10000::8000

2. spicec -h localhost -p 4003
3. ctrl + alt + l on the client (gnome)
4. unlock screen
5. spice-client does not respond (spice-client hangs requires sigkill)
6. session is ok after re-execution of spicec (ad 3)
  
Actual results:

from attached gdb (see thread apply all bt in gdb.txt)

Program received signal SIGSEGV, Segmentation fault.
_int_free (av=0x326ad8cea0, p=0x1b4edb0, have_lock=0) at malloc.c:4873
4873		  old_idx = fastbin_index(chunksize(old));


strace output: futex(0x326ad8cea0, FUTEX_WAIT_PRIVATE, 2, NULL

Expected results:

no segfault or hang should appear

Additional info:

qemu-kvm does not print any output so far
last line in spicec.log:

1307106556 WARN [10424:10424] get_selection: property contains no data (zero     length)

Comment 1 Lubos Kocman 2011-06-03 13:18:03 UTC
Created attachment 502809 [details]
spicec log

Comment 2 Lubos Kocman 2011-06-03 13:29:12 UTC
Additional Note: Guest is using KDE Desktop. Seems like it's somehow related to spice-vdagentd as I'm not facing to this issue after stopping it.

Comment 3 Lubos Kocman 2011-06-03 13:35:07 UTC
I wasn't able to reproduce this in gnome. And it took two attempts to get it reproduce on KDE (then once it happened, I'm falling to this issue always)

kdebase-4.3.4-4.el6.x86_64

Comment 5 Christophe Fergeau 2011-07-07 10:21:22 UTC
I installed a rhel6.1 guest with vdagent and KDE, locked the guest screen several times with ctrl+alt+l but couldn't not reproduce this issue :-/ (host is a fedora 15 system though, with spice-client 0.8.1 compiled from source)

Comment 6 Christophe Fergeau 2011-07-07 10:42:47 UTC
I managed to reproduce thanks to Uri. It's the desktop where spicec runs that has to be locked, not the desktop running inside the guest. The crash seems related to agent copy and paste support too, so before locking I copied some rich text from OOo outside of the guest, then locked, and spicec was crashed after unlocking.

Comment 7 Christophe Fergeau 2011-07-07 14:15:28 UTC
This is caused by a double free in client/x11/platform.cpp, first in get_selection() in the exit: case with ret_val == -1 and data != NULL. In this case, *data_ret (which is returned to the caller) has already been assigned "data", so it's pointing to freed memory.
Then in handle_selection_notify, get_selection_free is called on this pointer and will attempt to free it again.

Comment 8 Christophe Fergeau 2011-07-07 14:21:01 UTC
Created attachment 511721 [details]
proposed patch

An alternative would be not to call get_selection_free() in handle_selection_notify() when len == 0

Comment 10 Christophe Fergeau 2011-07-18 16:35:44 UTC
The patch from comment #8 has been committed to spice git master

Comment 11 Christophe Fergeau 2011-07-28 10:40:59 UTC
This bug fix is available in spice 0.8.2 which is being pushed to RHEL 6.2 ,
see https://brewweb.devel.redhat.com/buildinfo?buildID=173449 and
https://brewweb.devel.redhat.com/buildinfo?buildID=174105

Comment 13 David Jaša 2011-10-19 15:14:26 UTC
VERIFIED in 0.8.2-7, no crash or hang occurs.

Comment 14 Uri Lublin 2011-11-20 14:00:57 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    Double free of a pointer (data of X-selection -- see comment 7).

Consequence
    After locking/unlocking client screen, spice-client crashed (segfault).

Fix
    Free this pointer only once

Result
    After locking/unlocking client screen, spice-client does not crash.

Comment 15 errata-xmlrpc 2011-12-06 15:22:26 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.

http://rhn.redhat.com/errata/RHBA-2011-1518.html


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