Bug 65986 - Segfault from weston_compositor_pick_surface during a destroy_resource
Summary: Segfault from weston_compositor_pick_surface during a destroy_resource
Status: VERIFIED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: Other All
: medium critical
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-20 23:25 UTC by U. Artie Eoff
Modified: 2013-07-08 19:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
weston segfault gdb backtrace (10.18 KB, text/plain)
2013-06-20 23:25 UTC, U. Artie Eoff
Details
backtrace with weston compiled with ASAN (3.80 KB, text/plain)
2013-06-24 22:24 UTC, Hardening
Details

Description U. Artie Eoff 2013-06-20 23:25:22 UTC
Weston segfaults in a call to pixman_region32_contains_point() made from weston_compositor_pick_surface() and originating from destroy_resource() (see attached gdb backtrace).

This happens when selecting "close" from the weston client context menu and moving the mouse after a split second of selecting the "close" option.  It is somewhat tricky to reproduce due to the timing of the mouse move after clicking "close".  I am able to reproduce with weston-terminal the easiest.

wayland (master) heads/master-0-g7094441
fontconfig (master) heads/master-0-gcd9b103
drm (master) heads/master-0-ga0178c0
mesa (master) heads/master-0-gbbd2d57
libxkbcommon (master) heads/master-0-g6f06eb5
pixman (master) heads/master-0-g279bdcd
cairo (master) heads/master-0-gb7331f0
weston (master) heads/master-0-ga58290b
Comment 1 U. Artie Eoff 2013-06-20 23:25:52 UTC
Created attachment 81138 [details]
weston segfault gdb backtrace
Comment 2 Hardening 2013-06-24 22:24:08 UTC
Created attachment 81374 [details]
backtrace with weston compiled with ASAN

An additionnal backtrace, the test case is the same: open weston-terminal, click on the close button, and go over the dying surface with the mouse pointer. 
The backtrace is generated with the RDP compositor and weston compiled with clang+ASAN.
Comment 3 Rob Bradford 2013-06-26 16:44:28 UTC
(In reply to comment #2)
> Created attachment 81374 [details]
> backtrace with weston compiled with ASAN
> 
> An additionnal backtrace, the test case is the same: open weston-terminal,
> click on the close button, and go over the dying surface with the mouse
> pointer. 
> The backtrace is generated with the RDP compositor and weston compiled with
> clang+ASAN.

This backtrace is quite different and isn't related to the issue above.
Comment 4 U. Artie Eoff 2013-06-26 17:11:36 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Created attachment 81374 [details]
> > backtrace with weston compiled with ASAN
> > 
> > An additionnal backtrace, the test case is the same: open weston-terminal,
> > click on the close button, and go over the dying surface with the mouse
> > pointer. 
> > The backtrace is generated with the RDP compositor and weston compiled with
> > clang+ASAN.
> 
> This backtrace is quite different and isn't related to the issue above.

Perhaps this backtrace is more related to https://bugs.freedesktop.org/show_bug.cgi?id=66198?  Nonetheless, they are all encountered during similar use-cases.
Comment 5 Rob Bradford 2013-07-08 10:53:20 UTC
commit 27b1793857953927f842065a57cb5821a86bc671
Author: Rob Bradford <rob@linux.intel.com>
Date:   Wed Jun 26 18:08:46 2013 +0100

    compositor: rebuild the global list if we've removed a surface from it
    
    The list of surfaces used by weston_compositor_pick_surface() is
    maintained in list of surfaces stored on the compositor. This list is
    generated from the surfaces across all the layers using
    weston_compositor_build_surface_list.
    
    When destroying a surface the surface is "unmapped" with
    weston_surface_unmap which removes it from the layer list. However since
    the compositor surface list was only being rebuilt when the output was
    repainted a call to weston_compositor_pick_surface before the next
    output repaint would use an outdated surface list containing surfaces
    that have been partially destroyed.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=65986
    https://bugs.freedesktop.org/show_bug.cgi?id=66173
    https://bugs.freedesktop.org/show_bug.cgi?id=66198


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.