Bug 790749 - race that can lead to accessing freed memory
Summary: race that can lead to accessing freed memory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: spice-server
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Alon Levy
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-15 10:35 UTC by Yonit Halperin
Modified: 2012-06-20 12:17 UTC (History)
7 users (show)

Fixed In Version: spice-server-0.10.1-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 12:17:12 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0765 0 normal SHIPPED_LIVE spice-server bug fix and enhancement update 2012-06-19 19:30:21 UTC

Description Yonit Halperin 2012-02-15 10:35:29 UTC
Description of problem:

The channel event SPICE_CHANNEL_EVENT_DISCONNECTED is sent to qemu from the main thread context. However, the display and cursor channels, which run in different threads, can be already destroyed, together with the SpiceChannelEventInfo which is referenced in the above channel_event.

I saw it when I tested my patches for 788444 769512. I Added a print in qemu
when we expect SpiceChannelEventInfo with extended address flag set, and we receive the unset flag.
The error msg looks like "spice: channel_event, extended address is expected".
The above bug cause this msg to sometimes appear when the client disconnects, since the SpiceChannelEventInfo memory is no longer valid.
I saw it when the client disconnected from a src server during migration.
Reproducing the bug in this manner will be possible only after the patches for 788444 769512 are in the build.

Comment 2 Alon Levy 2012-02-20 11:59:57 UTC
patch upstream:

commit 5ec8515508828ecf5055de220cb0cc0f3c997a27
Author: Alon Levy <alevy>
Date:   Wed Feb 15 15:04:04 2012 +0200

    server, separate SpiceChannelEventInfo from RedStream
    
    fixes rhbz 790749 use after free of SpiceChannelEventInfo.
    
    The lifetime of the SpiceChannelEventInfo was that of RedsStream, but it
    is used by main_dispatcher_handle_channel_event after the RedsStream is
    freed for the cursor and display channels. Making SCEI allocation be at
    RedsStream allocation, and deallocation after the DESTROY event is
    processed by core->channel_event, fixes use after free.

Comment 6 David Jaša 2012-03-02 21:05:57 UTC
Based on developer description, it seems like one-time fix that shouldn't be tested regularly.

Alon, Yonit, if you think that this bug can regress, please reply and add 100% step-by-step reproducer.

Comment 7 David Jaša 2012-04-16 16:25:04 UTC
On hosts with spice-server-0.10.1-5.el6.x86_64 and qemu-kvm-0.12.1.2-2.270.el6.x86_64, I could not see nothing similar to "spice: channel_event, extended address is expected" after successive migrations so I think this can be marked as VERIFIED now.

Comment 10 errata-xmlrpc 2012-06-20 12:17:12 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-2012-0765.html


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