0 Replies Latest reply on Nov 22, 2009 12:19 PM by ibird

    Linux Ubuntu 9.04 fglrx_dri.so ( bug ? )

    ibird

       

      I am including OpenCL into an application, and i have installed the Beta driver. I have not problems with OpenCL, but with GtkGLExt and the beta driver. Doing some test with valgrindid i have founded a lot of invalid write / read of size 8 into fglrx drivers

      At first i has thinked it was a bug into the application or GtkGlExt, but this problems seem to be related to this beta driver and the fglrx of the last catalyst. On the open source Radeon driver this does not happen.

       

      This invalid read write do not crash the application, but debugging the application in single step mode ( and only on single step mode, indipendent from breakpoints and where you go in single step mode ) , randomly after some step the Linux GUI freeze and an hard reset is needed. Is not important if you use or not OpenCL


      Fortunately the application can work with cairo, so i can bypass the problem.


      I has done a deeper investigation into the GtkGlExt code and i has created a small sample code that reproduce this problem ( bug ? ) that seem to be related to GLX

      #include <X11/Xlib.h>
      #include <X11/Xutil.h>
      #include <GL/gl.h>
      #include <GL/glx.h>
      #include <stdio.h>
      #include <string.h>
      #include <stdlib.h>
      #include <gtk/gtk.h>
      #include <gdk/gdkx.h>

      int main()
      {
          Display *xdisplay;
          int screen_num;
          XVisualInfo *xvinfo;
          int is_rgba;

          gtk_init(NULL,NULL);

          xdisplay = gdk_x11_get_default_xdisplay ();
          screen_num = gdk_x11_get_default_screen ();

          int list[32];

          list[0] = GLX_BUFFER_SIZE;
          list[1] = 1;
          list[2] = GLX_DOUBLEBUFFER;
          list[3] = GLX_DEPTH_SIZE;
          list[4] = 1;
          list[5] = None;

          xvinfo = glXChooseVisual (xdisplay, screen_num, (int *) list);

          return 0;
      }

       

      line to compile

      g++ -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/atk-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lrt -lglib-2.0    -Wl,--export-dynamic -lGLU -lGL -lXmu -lXt -lSM -lICE -lgtk-x11-2.0 -lpangox-1.0 -lX11 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -o bug bug.cpp

       

      Valgrind output

       

      ==2177== Memcheck, a memory error detector.
      ==2177== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
      ==2177== Using LibVEX rev 1884, a library for dynamic binary translation.
      ==2177== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
      ==2177== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework.
      ==2177== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
      ==2177== For more details, rerun with: -v
      ==2177==
      ==2177== Invalid read of size 8
      ==2177==    at 0x48AC1A8: (within /usr/lib/libGL.so.1.2)
      ==2177==  Address 0x512f7c8 is 208 bytes inside a block of size 212 alloc'd
      ==2177==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
      ==2177==    by 0x48671EB: _gl_context_modes_create (in /usr/lib/libGL.so.1.2)
      ==2177==    by 0x512F48F: ???
      ==2177==
      ==2177== Syscall param ioctl(generic) points to uninitialised byte(s)
      ==2177==    at 0x40007F2: (within /lib/ld-2.9.so)
      ==2177==    by 0x4C6CD58: ioctl (in /lib/tls/i686/cmov/libc-2.9.so)
      ==2177==    by 0x68FCEB2: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xbee08d20 is on thread 1's stack
      ==2177==
      ==2177== Invalid read of size 8
      ==2177==    at 0x69777A8: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0x52110d8 is 0 bytes after a block of size 640 alloc'd
      ==2177==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
      ==2177==    by 0x488FC97: AtiCallFGLCWDDE (in /usr/lib/libGL.so.1.2)
      ==2177==
      ==2177== Conditional jump or move depends on uninitialised value(s)
      ==2177==    at 0x6951461: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==    by 0x6950BE5: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==    by 0x69483DB: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==
      ==2177== Invalid read of size 4
      ==2177==    at 0x6975FED: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77fe000 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975F83: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee000 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975F87: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee010 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975F8C: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee020 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975F91: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee030 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975FAA: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee040 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975FAF: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee050 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975FB4: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee060 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6975FB9: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ee070 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x676206C: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb782d300 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C1F: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841000 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C23: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841010 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C32: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841020 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C37: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841030 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C46: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841040 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C4B: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841050 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C60: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841060 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977C65: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7841070 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E65: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7842880 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E6F: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb7842890 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E79: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb78428a0 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E83: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb78428b0 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E8D: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb78428c0 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977E97: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb78428d0 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 8
      ==2177==    at 0x6977EA1: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb78428e0 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x697743D: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed000 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977443: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed004 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977449: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed008 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x697744F: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed00c is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977455: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed010 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x697745B: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed014 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977461: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed018 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977467: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed01c is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x697746D: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed020 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977473: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed024 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x6977479: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed028 is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== Invalid write of size 4
      ==2177==    at 0x697747F: (within /usr/lib/dri/fglrx_dri.so)
      ==2177==  Address 0xb77ed02c is not stack'd, malloc'd or (recently) free'd
      ==2177==
      ==2177== ERROR SUMMARY: 1311618 errors from 41 contexts (suppressed: 209 from 6)
      ==2177== malloc/free: in use at exit: 1,757,029 bytes in 12,001 blocks.
      ==2177== malloc/free: 38,662 allocs, 26,661 frees, 3,521,521 bytes allocated.
      ==2177== For counts of detected errors, rerun with: -v
      ==2177== Use --track-origins=yes to see where uninitialised values come from
      ==2177== searching for pointers to 12,001 not-freed blocks.
      ==2177== checked 3,270,736 bytes.
      ==2177==
      ==2177== LEAK SUMMARY:
      ==2177==    definitely lost: 1,446 bytes in 20 blocks.
      ==2177==      possibly lost: 162,996 bytes in 123 blocks.
      ==2177==    still reachable: 1,592,587 bytes in 11,858 blocks.
      ==2177==         suppressed: 0 bytes in 0 blocks.
      ==2177== Rerun with --leak-check=full to see details of leaked memory.

      This sample code do not freeze the Linux GUI in single step debug mode, but a more complex use of GLX like gtkglext, freeze the GUI in single step debug mode.

      i want remark that the problem is related to the last linux Catalyst and the last beta driver for OpenCL. Open source radeon driver do not have this problem