Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-2992

Segfault due to missing NULL check

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.1.0
    • mesa
    • None
    • Moderate
    • rhel-sst-gpu
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      The issue does not happen in recent mesa sources, but apparently the code path
      leading to the crash is in all rhel9 packages.

      #0 dri_put_drawable (pdp=<optimized out>) at ../src/gallium/frontends/dri/dri_util.c:706
      706 pdp->loaderPrivate = NULL;
      [Current thread is 1 (Thread 0x7ff2a3367a80 (LWP 8515))]
      (gdb) bt
      #0 dri_put_drawable (pdp=<optimized out>) at ../src/gallium/frontends/dri/dri_util.c:706
      #1 driDestroyDrawable (pdp=0x0) at ../src/gallium/frontends/dri/dri_util.c:708
      #2 0x00007ff295e02e55 in dri2_x11_create_surface (disp=disp@entry=0x5629a050e220, type=type@entry=4, conf=<optimized out>,
      native_surface=<optimized out>, attrib_list=0x0) at ../src/egl/drivers/dri2/platform_x11.c:370
      #3 0x00007ff295e031f2 in dri2_x11_create_window_surface (disp=0x5629a050e220, conf=<optimized out>, native_window=<optimized out>,
      attrib_list=<optimized out>) at ../src/egl/drivers/dri2/platform_x11.c:390
      #4 0x00007ff295defa10 in _eglCreateWindowSurfaceCommon (disp=0x5629a050e220, config=<optimized out>, native_window=0x400003, attrib_list=0x0)
      at ../src/egl/main/eglapi.c:1000
      #5 0x000056299fbbc8f7 in get_gles_renderer () at ../tools/gnome-session-check-accelerated-gles-helper.c:164
      #6 0x000056299fbbc559 in main (argc=<optimized out>, argv=<optimized out>) at ../tools/gnome-session-check-accelerated-gles-helper.c:221

      While dri_put_drawable checks for a NULL pointer:

      /usr/src/debug/mesa-22.1.5-2.el9.x86_64/redhat-linux-build/../src/gallium/frontends/dri/dri_util.c:

      648 static void dri_put_drawable(__DRIdrawable *pdp)
      649 {
      650 if (pdp) {
      651 pdp->refcount--;
      652 if (pdp->refcount)
      653 return;
      ...

      this code path dereferences a NULL pointer:

      695 static void
      696 driDestroyDrawable(__DRIdrawable *pdp)
      ...
      705 */
      706 pdp->loaderPrivate = NULL;
      707
      708 dri_put_drawable(pdp);

      Regardless of it being caused by some kind of misconfiguration, this segfault
      should not happen.

              rh-ee-jexposit Jose Exposito Quintana
              rhn-support-pandrade Paulo Andrade
              David Airlie David Airlie
              Desktop QE Desktop QE
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: