After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793506 - gnome-session-check-acceleration: don't crash when on X11 with a nested wayland compositor running
gnome-session-check-acceleration: don't crash when on X11 with a nested wayla...
Status: RESOLVED OBSOLETE
Product: gnome-session
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-02-16 10:55 UTC by Guido Günther
Modified: 2021-06-14 18:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-g-s-check-acceleration-don-t-crash-on-X11-with-neste.patch (4.32 KB, patch)
2018-02-16 10:56 UTC, Guido Günther
reviewed Details | Review

Description Guido Günther 2018-02-16 10:55:01 UTC
When running on X11 with a nested wayland (e.g. weston) GDK will default
to wayland so looking for X11 atoms will not work (and crash) like:
    
    $ valgrind _build/tools/gnome-session-check-accelerated
    
      ==6138== Memcheck, a memory error detector
      ==6138== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
      ==6138== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
      ==6138== Command: _build/tools/gnome-session-check-accelerated
      ==6138==
      ==6138== Invalid read of size 8
      ==6138==    at 0x517AD8A: XInternAtom (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
      ==6138==    by 0x610D28C: gdk_x11_atom_to_xatom_for_display (gdkproperty-x11.c:115)
      ==6138==    by 0x1092DF: main (gnome-session-check-accelerated.c:162)
      ==6138==  Address 0xe8bc6f8 is 1,000 bytes inside a block of size 1,024 free'd
      ==6138==    at 0x4C2DDBB: free (vg_replace_malloc.c:530)
      ==6138==    by 0x4E71A1C: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x4E71BBA: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x4E71F6A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x63C363F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x63C9811: g_type_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x63A73C7: g_enum_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x9C7D146: g_bus_type_get_type (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
      ==6138==    by 0x9CAB8A8: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
      ==6138==    by 0x63C71B8: g_type_class_ref (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x9CADB18: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
      ==6138==    by 0x9CAE9C6: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.5400.3)
      ==6138==  Block was alloc'd at
      ==6138==    at 0x4C2EBA5: calloc (vg_replace_malloc.c:711)
      ==6138==    by 0x4E89580: g_malloc0 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x4E71957: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x4E71BBA: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x4E71F6A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5400.3)
      ==6138==    by 0x63C363F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x63C9811: g_type_register_static (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x63C9AE4: g_type_register_static_simple (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5400.3)
      ==6138==    by 0x6135F26: _gdk_wayland_visual_get_type (gdkscreen-wayland.c:706)
      ==6138==    by 0x6135F85: gdk_wayland_visual_new (gdkscreen-wayland.c:813)
      ==6138==    by 0x6135F85: _gdk_wayland_screen_new (gdkscreen-wayland.c:838)
      ==6138==    by 0x61305BE: _gdk_wayland_display_open (gdkdisplay-wayland.c:585)
      ==6138==    by 0x60D3972: gdk_display_manager_open_display (gdkdisplaymanager.c:472)
    
Skip the check in this case so gnome-session can be tested under these
conditions too.
Comment 1 Guido Günther 2018-02-16 10:56:03 UTC
Created attachment 368410 [details] [review]
0001-g-s-check-acceleration-don-t-crash-on-X11-with-neste.patch
Comment 2 Ray Strode [halfline] 2018-02-20 19:32:03 UTC
Review of attachment 368410 [details] [review]:

::: tools/gnome-session-check-accelerated.c
@@ +161,3 @@
+         * so looking for X11 atoms will not work (and crash).
+         */
+        if (!GDK_IS_X11_DISPLAY (display)) {

so couldn't this new check replace the  g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") != 0 check instead of augment it?
Comment 3 Guido Günther 2018-02-21 10:00:34 UTC
Reading the comment above this check I thought the code wanted to avoid invoking anything that would rely on X so it would not want to invoke gdk_display_get_default() ?
Comment 4 Michal Srb 2018-07-18 15:29:58 UTC
I believe the issue is actually in GDK. The gnome-session-check-accelerated already established that it is running in X11 session, so it rightfully assumes that the display it got from `gdk_display_get_default` is a GdkX11Display.

The fact that GDK opened a Wayland display that is completely unrelated to the current X11 session is a bug in GDK. I just reported it here, with detailed description why is it happening:
https://gitlab.gnome.org/GNOME/gtk/issues/1224

Adding the proposed check to gnome-session-check-accelerated would just paper over the problem.
Comment 5 André Klapper 2021-06-14 18:21:52 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of gnome-session, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/gnome-session/-/issues/

Thank you for your understanding and your help.