<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Use of uninitialized pointer in 'gallium_screen_create()'"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=75335">75335</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Use of uninitialized pointer in 'gallium_screen_create()'
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>christian.prochaska@genode-labs.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>(git master 9b2fe7cf96dc25f52ae43c8dfda20ee354c329f2)

I've built Mesa with the following configuration:

./autogen.sh --enable-gles2 --disable-glx --with-dri-drivers=
--enable-gallium-egl --with-egl-platforms=drm --with-gallium-drivers=i915

When running the 'es2gears' example, a segmentation fault occurs.

Backtrace:

----------
Starting program:
/home/christian/projects/mesa/demos/src/egl/opengles2/./es2gears 
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb71f1505 in pipe_loader_create_screen (dev=0xb71f1378
<gallium_screen_create+8>, library_paths=0xb72fb3c0
"/usr/local/lib/gallium-pipe") at pipe_loader.c:68
68       return dev->ops->create_screen(dev, library_paths);
(gdb) bt
#0  0xb71f1505 in pipe_loader_create_screen (dev=0xb71f1378
<gallium_screen_create+8>, library_paths=0xb72fb3c0
"/usr/local/lib/gallium-pipe") at pipe_loader.c:68
#1  0xb71f13ab in gallium_screen_create (gdrm=gdrm@entry=0x8053fc0) at gbm.c:60
#2  0xb71f1d15 in gbm_gallium_drm_device_create (fd=7) at gbm_drm.c:248
#3  0xb7d6e643 in _gbm_create_device (fd=fd@entry=7) at main/backend.c:117
#4  0xb7d6e07f in gbm_create_device (fd=fd@entry=7) at main/gbm.c:155
#5  0xb77eae05 in native_create_display (dpy=0x0, use_sw=0 '\000') at
drm/native_drm.c:246
#6  0xb77e755b in egl_g3d_initialize (drv=0x8053990, dpy=0x804f008) at
common/egl_g3d.c:539
#7  0xb7fbed32 in _eglMatchAndInitialize (dpy=<optimized out>) at
egldriver.c:605
#8  0xb7fbf0e4 in _eglMatchDriver (dpy=dpy@entry=0x804f008,
test_only=test_only@entry=0) at egldriver.c:636
#9  0xb7fb9dc8 in eglInitialize (dpy=0x804f008, major=0x804e42c
<_eglut_state+44>, minor=0x804e430 <_eglut_state+48>) at eglapi.c:318
#10 0x0804bdfa in eglutInit (argc=1, argv=0xbffff754) at ../eglut/eglut.c:219
#11 0x0804b324 in main (argc=1, argv=0xbffff754) at es2gears.c:707
(gdb) 
----------

The error seems to be caused by the use of an uninitialized pointer in
'gallium_screen_create()':

----------
int
gallium_screen_create(struct gbm_gallium_drm_device *gdrm)
{
   struct pipe_loader_device *dev;
#ifdef HAVE_PIPE_LOADER_DRM
   int ret;

   ret = pipe_loader_drm_probe_fd(&dev, gdrm->base.base.fd, true);
   if (!ret)
      return -1;
#endif /* HAVE_PIPE_LOADER_DRM */

   gdrm->screen = pipe_loader_create_screen(dev, get_library_search_path());
----------

With my configuration, HAVE_PIPE_LOADER_DRM is not defined, so the 'dev'
pointer does not get initialized.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>