Bug 1566101 - epoxy_glx_version & friends crash without GLX and hinder gtk3 startup
Summary: epoxy_glx_version & friends crash without GLX and hinder gtk3 startup
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libepoxy
Version: 7.6
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Debarshi Ray
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks: 1566585
TreeView+ depends on / blocked
 
Reported: 2018-04-11 14:15 UTC by Debarshi Ray
Modified: 2018-10-30 08:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1566585 (view as bug list)
Environment:
Last Closed: 2018-10-30 08:02:18 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3059 None None None 2018-10-30 08:02:52 UTC

Description Debarshi Ray 2018-04-11 14:15:28 UTC
libepoxy-1.3.1-1.el7 crashes inside epoxy_glx_version if GLX is not available. eg., x2go or xvfb. This leads to gtk3 applications crashing on start-up. Here's an example crash from gnome-terminal:

Program received signal SIGSEGV, Segmentation fault.
__rawmemchr_sse2 () at ../sysdeps/x86_64/rawmemchr.S:37
37		movdqu	(%rdi), %xmm0

Thread 1 (Thread 0x7ffff7f37a80 (LWP 17126)):
#0  0x00007ffff422ee6f in __rawmemchr_sse2 () at ../sysdeps/x86_64/rawmemchr.S:37
#1  0x00007ffff42179d2 in _IO_str_init_static_internal (sf=sf@entry=0x7fffffffd080, ptr=ptr@entry=0x0, size=size@entry=0, pstart=pstart@entry=0x0) at strops.c:44
        fp = 0x7fffffffd080
        end = <optimized out>
#2  0x00007ffff42054f7 in __GI___isoc99_vsscanf (string=0x0, format=0x7ffff24f7e72 "%d.%d", args=args@entry=0x7fffffffd1a8) at isoc99_vsscanf.c:41
        ret = -195705760
        sf = 
            {_sbf = {_f = {_flags = -72515584, _IO_read_ptr = 0x0, _IO_read_end = 0x0, _IO_read_base = 0x0, _IO_write_base = 0x0, _IO_write_ptr = 0x0, _IO_write_end = 0x0, _IO_buf_base = 0x0, _IO_buf_end = 0x0, _IO_save_base = 0x0, _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers = 0x0, _chain = 0x0, _fileno = 0, _flags2 = 0, _old_offset = 0, _cur_column = 0, _vtable_offset = 0 '\000', _shortbuf = "", _lock = 0x0, _offset = -281474976710656, _codecvt = 0xffffffffff000000, _wide_data = 0x0, _freeres_list = 0x0, _freeres_buf = 0x0, _freeres_size = 0, _mode = -1, _unused2 = "ht-mm\000refres@@@@@@@@"}, vtable = 0x7ffff455c460 <_IO_str_jumps>}, _s = {_allocate_buffer = 0x5b5b5b5b5b5b5b5b, _free_buffer = 0x5b5b5b5b5b5b5b5b}}
#3  0x00007ffff4205497 in __isoc99_sscanf (s=<optimized out>, format=format@entry=0x7ffff24f7e72 "%d.%d") at isoc99_sscanf.c:32
        arg = {{gp_offset = 16, fp_offset = 48, overflow_arg_area = 0x7fffffffd280, reg_save_area = 0x7fffffffd1c0}}
        done = -195705760
#4  0x00007ffff24db862 in epoxy_glx_version (dpy=dpy@entry=0x651000, screen=screen@entry=0) at dispatch_glx.c:60
        server_major = 6623232
        server_minor = 150
        client_major = 157
        client_minor = 95
        server = <optimized out>
        client = <optimized out>
        version_string = <optimized out>
        ret = <optimized out>
        __PRETTY_FUNCTION__ = "epoxy_glx_version"
#5  0x00007ffff6aa2fa7 in gdk_x11_screen_init_gl (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkglcontext-x11.c:866
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        dpy = 0x651000
        error_base = 157
        event_base = 95
        screen_num = 0
        __FUNCTION__ = "gdk_x11_screen_init_gl"
#6  0x00007ffff6aa3528 in _gdk_x11_screen_update_visuals_for_gl (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkglcontext-x11.c:1210
        x11_screen = 0x662030 [GdkX11Screen]
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        dpy = 0x651000
        gl_info = <optimized out>
        i = <optimized out>
        system_visual_id = 6
        rgba_visual_id = 6692912
#7  0x00007ffff6aac435 in _gdk_x11_screen_init_visuals (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkvisual-x11.c:309
        possible_depths = {32, 30, 24, 16, 15, 8, 4, 1}
        possible_types = {GDK_VISUAL_DIRECT_COLOR, GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, GDK_VISUAL_STATIC_GRAY}
        x11_screen = 0x662030 [GdkX11Screen]
        visual_list = <optimized out>
        visual_template = 
          {visual = 0x0, visualid = 6691248, screen = 0, depth = 0, class = 0, red_mask = 140737488344616, green_mask = 4301590528, blue_mask = 0, colormap_size = 0, bits_per_rgb = 0}
        temp_visual = <optimized out>
        default_xvisual = <optimized out>
        visuals = 0x661fc0
        nxvisuals = 6
        nvisuals = <optimized out>
        i = <optimized out>
        j = <optimized out>
        __FUNCTION__ = "_gdk_x11_screen_init_visuals"
#8  0x00007ffff6aa92b0 in _gdk_x11_screen_new (display=display@entry=0x65d0f0 [GdkX11Display], screen_number=0) at gdkscreen-x11.c:940
        screen = 0x662030 [GdkX11Screen]
        x11_screen = 0x662030 [GdkX11Screen]
        display_x11 = 0x65d0f0 [GdkX11Display]
        scale_str = <optimized out>
#9  0x00007ffff6a98968 in _gdk_x11_display_open (display_name=<optimized out>) at gdkdisplay-x11.c:1603
        xdisplay = <optimized out>
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        attr = 
          {title = 0x5 <Address 0x5 out of bounds>, event_mask = 0, x = 0, y = 0, width = 0, height = -380495104, wclass = (unknown: 1684387266), visual = 0x0, window_type = GDK_WINDOW_ROOT, cursor = 0x0, wmclass_name = 0x7fffffffd901 "\227d", wmclass_class = 0x630f80 "*", override_redirect = -156485521, type_hint = 32767}
        argc = <optimized out>
        argv = {0x0}
        class_hint = <optimized out>
        pid = 1
        ignore = 147
        maj = 0
        min = 0
        __FUNCTION__ = "_gdk_x11_display_open"
#10 0x00007ffff6a6c7b9 in gdk_display_manager_open_display (manager=<optimized out>, name=0x0) at gdkdisplaymanager.c:472
        backend = 0x630f80 "*"
        any = <optimized out>
        backend_list = <optimized out>
        display = 0x0
        backends = 0x631120
        i = <optimized out>
        allow_any = 1
        __FUNCTION__ = "gdk_display_manager_open_display"
#11 0x00007ffff6f58246 in post_parse_hook (context=<optimized out>, group=<optimized out>, data=0x62eac0, error=0x7fffffffd928) at gtkmain.c:801
        info = 0x62eac0
#12 0x00007ffff51a8af8 in g_option_context_parse (context=context@entry=0x64a000, argc=argc@entry=0x7fffffffd91c, argv=argv@entry=0x7fffffffd910, error=error@entry=0x7fffffffd928) at goption.c:2165
        group = <optimized out>
        i = 1
        j = <optimized out>
        k = <optimized out>
        list = 0x64be00 = {0x64b9b0, 0x64c0d0, 0x64bc60, 0x64bd50, 0x64cd90}
#13 0x0000000000409108 in terminal_options_parse (working_directory=working_directory@entry=0x649730 "/mnt/qa/scratch/x86-64-7s-m1/2018:33372/tps", startup_id=startup_id@entry=0x0, argcp=argcp@entry=0x7fffffffd91c, argvp=argvp@entry=0x7fffffffd910, error=error@entry=0x7fffffffd928) at terminal-options.c:868
        options = 0x649820
        context = 0x64a000
        retval = <optimized out>
        i = <optimized out>
        argv = <optimized out>
#14 0x0000000000405f89 in main (argc=1, argv=0x7fffffffdb78) at terminal.c:375
        i = <optimized out>
        argv_copy = 0x62e620
        startup_id = 0x0
        display_name = <optimized out>
        display = <optimized out>
        options = 0x0
        factory = 0x0
        error = 0x0
        working_directory = 0x649730 "/mnt/qa/scratch/x86-64-7s-m1/2018:33372/tps"
        exit_code = 1
        service_name = <optimized out>


This was found by tpelka in the context of bug 1502788.

Note that bug 1502788 is specifically about crashes with X servers that use gtk3's RandR 1.3 code path, and xvfb uses RandR 1.5. All versions of gtk3 shipped in RHEL 7.x were fixed as far as RandR 1.5 servers are concerned. However, RHEL 7.x has a relatively old libepoxy so the start-up fails in a different way with RandR 1.5.


This was fixed in the following upstream commit:

commit a15a92c2cbe0a8f45a1ff6258b22957c17c7118e
Author: Emmanuele Bassi <ebassi@gnome.org>
Date:   Mon Dec 12 14:18:15 2016 +0000

    Ensure we don't assert if GLX is not available
    
    Certain X server do not have GLX enabled or supported, such as x2go. We
    can handle this case gracefully inside libepoxy.

Comment 2 Debarshi Ray 2018-04-11 14:16:20 UTC
Scratch build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15765897

Comment 3 Tomas Pelka 2018-04-11 14:36:30 UTC
Note that the same happen with nautilus and gedit, originally found when testing bz1565096.

Comment 4 Tomas Pelka 2018-04-11 14:47:14 UTC
Unfortunately with 
libepoxy-1.3.1-2.el7.x86_64
gtk3-3.22.26-4.el7_5.x86_64

still getting:

# gdb /usr/bin/gnome-terminal 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gnome-terminal...Reading symbols from /usr/lib/debug/usr/bin/gnome-terminal.debug...done.
done.
(gdb) r
Starting program: /usr/bin/gnome-terminal 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strstr_sse2 (haystack_start=0x0, needle_start=0x7ffff6af1718 "GLX_ARB_create_context_profile") at ../string/strstr.c:63
63        while (*haystack && *needle)
(gdb) thread appl all bt full

Thread 1 (Thread 0x7ffff7f37a80 (LWP 32612)):
#0  0x00007ffff423e5d1 in __strstr_sse2 (haystack_start=0x0, needle_start=0x7ffff6af1718 "GLX_ARB_create_context_profile") at ../string/strstr.c:63
        haystack = 0x0
        needle = 0x7ffff6af1718 "GLX_ARB_create_context_profile"
        needle_len = <optimized out>
        haystack_len = <optimized out>
        ok = true
#1  0x00007ffff2499614 in epoxy_extension_in_string (extension_list=<optimized out>, ext=ext@entry=0x7ffff6af1718 "GLX_ARB_create_context_profile") at dispatch_common.c:355
        ptr = 0x0
        len = <optimized out>
#2  0x00007ffff24db989 in epoxy_has_glx_extension (dpy=dpy@entry=0x651000, screen=screen@entry=0, ext=ext@entry=0x7ffff6af1718 "GLX_ARB_create_context_profile")
    at dispatch_glx.c:110
#3  0x00007ffff6aa2fd8 in gdk_x11_screen_init_gl (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkglcontext-x11.c:871
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        dpy = 0x651000
        error_base = 157
        event_base = 95
        screen_num = 0
        __FUNCTION__ = "gdk_x11_screen_init_gl"
#4  0x00007ffff6aa3528 in _gdk_x11_screen_update_visuals_for_gl (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkglcontext-x11.c:1210
        x11_screen = 0x662030 [GdkX11Screen]
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        dpy = 0x651000
        gl_info = <optimized out>
        i = <optimized out>
        system_visual_id = 6
        rgba_visual_id = 6692912
#5  0x00007ffff6aac435 in _gdk_x11_screen_init_visuals (screen=screen@entry=0x662030 [GdkX11Screen]) at gdkvisual-x11.c:309
        possible_depths = {32, 30, 24, 16, 15, 8, 4, 1}
        possible_types = {GDK_VISUAL_DIRECT_COLOR, GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, GDK_VISUAL_STATIC_GRAY}
        x11_screen = 0x662030 [GdkX11Screen]
        visual_list = <optimized out>
        visual_template = 
          {visual = 0x0, visualid = 6682864, screen = 0, depth = 0, class = 0, red_mask = 140737488344616, green_mask = 4301590528, blue_mask = 0, colormap_size = 0, bits_per_rgb = 0}
        temp_visual = <optimized out>
        default_xvisual = <optimized out>
        visuals = 0x62aa50
        nxvisuals = 6
        nvisuals = <optimized out>
        i = <optimized out>
        j = <optimized out>
        __FUNCTION__ = "_gdk_x11_screen_init_visuals"
#6  0x00007ffff6aa92b0 in _gdk_x11_screen_new (display=display@entry=0x65d0f0 [GdkX11Display], screen_number=0) at gdkscreen-x11.c:940
        screen = 0x662030 [GdkX11Screen]
        x11_screen = 0x662030 [GdkX11Screen]
        display_x11 = 0x65d0f0 [GdkX11Display]
        scale_str = <optimized out>
#7  0x00007ffff6a98968 in _gdk_x11_display_open (display_name=<optimized out>) at gdkdisplay-x11.c:1603
        xdisplay = <optimized out>
        display = 0x65d0f0 [GdkX11Display]
        display_x11 = 0x65d0f0 [GdkX11Display]
        attr = 
          {title = 0x5 <Address 0x5 out of bounds>, event_mask = 0, x = 0, y = 0, width = 0, height = 1087953920, wclass = (GDK_INPUT_ONLY | unknown: 801181138), visual = 0x0, window_type = GDK_WINDOW_ROOT, cursor = 0x0, wmclass_name = 0x7fffffffd901 "\227d", wmclass_class = 0x630f80 "*", override_redirect = -156485521, type_hint = 32767}
        argc = <optimized out>
        argv = {0x0}
        class_hint = <optimized out>
        pid = 1
        ignore = 147
        maj = 0
        min = 0
        __FUNCTION__ = "_gdk_x11_display_open"
#8  0x00007ffff6a6c7b9 in gdk_display_manager_open_display (manager=<optimized out>, name=0x0) at gdkdisplaymanager.c:472
        backend = 0x630f80 "*"
        any = <optimized out>
        backend_list = <optimized out>
        display = 0x0
        backends = 0x631120
        i = <optimized out>
        allow_any = 1
        __FUNCTION__ = "gdk_display_manager_open_display"
#9  0x00007ffff6f58246 in post_parse_hook (context=<optimized out>, group=<optimized out>, data=0x62eac0, error=0x7fffffffd928) at gtkmain.c:801
        info = 0x62eac0
#10 0x00007ffff51a8af8 in g_option_context_parse (context=context@entry=0x64a000, argc=argc@entry=0x7fffffffd91c, argv=argv@entry=0x7fffffffd910, error=error@entry=0x7fffffffd928) at goption.c:2165
        group = <optimized out>
        i = 1
        j = <optimized out>
        k = <optimized out>
        list = 0x64be00 = {0x64b9b0, 0x64c0d0, 0x64bc60, 0x64bd50, 0x64cd90}
#11 0x0000000000409108 in terminal_options_parse (working_directory=working_directory@entry=0x649730 "/mnt/qa/scratch/x86-64-7s-m1/2018:33372/tps", startup_id=startup_id@entry=0x0, argcp=argcp@entry=0x7fffffffd91c, argvp=argvp@entry=0x7fffffffd910, error=error@entry=0x7fffffffd928) at terminal-options.c:868
        options = 0x649820
        context = 0x64a000
        retval = <optimized out>
        i = <optimized out>
        argv = <optimized out>
#12 0x0000000000405f89 in main (argc=1, argv=0x7fffffffdb78) at terminal.c:375
        i = <optimized out>
        argv_copy = 0x62e620
        startup_id = 0x0
        display_name = <optimized out>
        display = <optimized out>
        options = 0x0
        factory = 0x0
        error = 0x0
        working_directory = 0x649730 "/mnt/qa/scratch/x86-64-7s-m1/2018:33372/tps"
        exit_code = 1
        service_name = <optimized out>

Comment 5 Debarshi Ray 2018-04-11 15:25:29 UTC
Some more relevant fixes:

commit 7a1a79ec3b68857f8a0b1d26811fec2d00ea4fb2
Author: Emmanuele Bassi <ebassi@gnome.org>
Date:   Wed Dec 7 15:12:15 2016 +0000

    Avoid C99 declaration after statement
    
    The rest of the library is C89-only, so we should keep it that way.

commit 31a1fd9d6dcf298b7ed61ac06d54e6f9cd2dee03
Author: Yaron Cohen-Tal <yaronct@gmail.com>
Date:   Fri Jul 29 17:55:49 2016 +0300

    Check for NULL extensions string
    
    Some X server not supporting any OpenGL feature, glXQueryExtensionsString
    will return NULL and causes the function to fail.
    
    Thanks to Emmanuel Stapf (manus@eiffel.com) for the original patch.
    
    This was verified running an application on macOS while the X server was
    running on Windows Xming 7.5.0.10
    
    Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>

Comment 6 Debarshi Ray 2018-04-11 15:27:10 UTC
I believe bug 1395366 is the Fedora equivalent of this.

Ideally, we'd rebase libepoxy to >= 1.4, and use this gtk+ fix from gtk4:
https://bugzilla.gnome.org/show_bug.cgi?id=775279

Comment 7 Debarshi Ray 2018-04-11 15:34:33 UTC
Here's another scratch build:
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15766924

Comment 8 Tomas Pelka 2018-04-12 08:57:07 UTC
Scratch build works. Are we going to incorporate into the same z-stream erratum for gtk3?

Comment 9 Debarshi Ray 2018-04-12 12:38:03 UTC
(In reply to Tomas Pelka from comment #8)
> Scratch build works. Are we going to incorporate into the same z-stream
> erratum for gtk3?

Yes, let's do that.

Comment 14 errata-xmlrpc 2018-10-30 08:02:18 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.

https://access.redhat.com/errata/RHSA-2018:3059


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