Bug 54598 - segmentation violation caused by undetected failure of XcursorLibraryLoadImages()
Summary: segmentation violation caused by undetected failure of XcursorLibraryLoadImag...
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-06 14:59 UTC by Knut Petersen
Modified: 2012-10-29 17:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Petersen 2012-09-06 14:59:04 UTC
weston --xserver segfaults during xserver startup when no xcursors are found:


#0  0xb5b35521 in xcb_cursor_images_load_cursor (wm=0x83b7030, images=0x0) at window-manager.c:182
#1  0xb5b355d6 in xcb_cursor_library_load_cursor (wm=0x83b7030, file=0xb5b3ea94 "top_side") at window-manager.c:207
#2  0xb5b371ab in weston_wm_create_cursors (wm=0x83b7030) at window-manager.c:988
#3  0xb5b381a3 in weston_wm_create (wxs=0x83b8bf0) at window-manager.c:1469
#4  0xb5b3a41a in bind_xserver (client=0x838a248, data=0x83b8bf0, version=1, id=11) at launcher.c:165
#5  0xb74c4318 in display_bind (client=0x838a248, resource=0x83ad9b0, name=12, interface=0x83ae71c "xserver", version=1, id=11) at wayland-server.c:923
#6  0xb74bb522 in ffi_call_SYSV () at ../../../libffi/src/x86/sysv.S:64
#7  0xb74bb2be in ffi_call (cif=0x83ae6a0, fn=0xb74c4272 <display_bind>, rvalue=0xbffb8b8c, avalue=0x83ae6b8) at ../../../libffi/src/x86/ffi.c:324
#8  0xb74c8aa5 in wl_closure_invoke (closure=0x83ae648, target=0x83ad9b0, func=0xb74c4272 <display_bind>, data=0x838a248) at connection.c:855
#9  0xb74c2fb1 in wl_client_connection_data (fd=25, mask=1, data=0x838a248) at wayland-server.c:284
#10 0xb74c671d in wl_event_source_fd_dispatch (source=0x84908f8, ep=0xbffb8c40) at event-loop.c:79
#11 0xb74c7065 in wl_event_loop_dispatch (loop=0x80654e0, timeout=-1) at event-loop.c:410
#12 0xb74c4896 in wl_display_run (display=0x80654b0) at wayland-server.c:1103
#13 0x08056679 in main (argc=1, argv=0xbffb9044) at compositor.c:4131


This is caused by an undetected fail of XcursorLibraryLoadImages() in xcb_cursor_images_load_cursor(). The returned null-pointer is assigned to images, later it causes the segmentation violation in  cb_cursor_images_load_cursor().

Immediate workaround: Make sure that a proper xcursor theme is installed as default:

       export XCURSOR_PATH=$PREFIX/share/icons
       ln -s path_to_cursor_theme $XCURSOR_PATH/default
       $PREFIX/bin/weston --xserver


Todo:

The build documentation really should be updated to document the xcursor dependency.

XCURSOR_PATH should be documented in weston.1

In the code the  pointer returned by XcursorLibraryLoadImages() must be checked before it is used, but I think the best idea would be to abort at weston startup if the required cursor images are not provided by the system.

Adding proper xcursors would be even better.

cu,
 Knut
Comment 1 Kristian Høgsberg 2012-10-25 16:15:40 UTC
This should be fixed now, can you verify?
Comment 2 Tiago Vignatti 2012-10-25 16:48:26 UTC
But did you actually applied the patches: 

http://lists.freedesktop.org/archives/wayland-devel/2012-October/005696.html
Comment 3 Knut Petersen 2012-10-26 13:06:59 UTC
(In reply to comment #1)
> This should be fixed now, can you verify?

It´s harder to hit as there are default cursors now, but in a broken installation it probably segfaults as XcursorLibraryLoadImages() will return NULL, and that currently still is used as a pointer.

cu,
 Knut
Comment 4 Kristian Høgsberg 2012-10-29 17:27:20 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > This should be fixed now, can you verify?
> 
> It´s harder to hit as there are default cursors now, but in a broken
> installation it probably segfaults as XcursorLibraryLoadImages() will return
> NULL, and that currently still is used as a pointer.

Oh, this is actually not related to the default cursors.  This is about loading regular X cursors for xwm which is just an X client.  I've pushed Tiagos patches.


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.