Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind reports lots of errors when running opengl program on ATI - should I worry? [closed]

I have a very complex OpenGL application running on a embedded device with ATI graphical chip, running a RT linux. The application's part are tested with unit tests. They all pass and no memory leak or invalid access is reported. However, the application has some quirks and some things do not behave nicely.

Today I tried to run this application using valgrind, and during the initialization I see some invalid memory reads/writes, all of them related to the ATI driver :

==14347== Invalid read of size 8
==14347==    at 0x67C3868: ??? (in /usr/lib/catalyst/libGL.so.1.2)
==14347==  Address 0x8f6b398 is 208 bytes inside a block of size 212 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0x6762701: ??? (in /usr/lib/catalyst/libGL.so.1.2)
==14347==    by 0x8F6B05F: ???
==14347== 
==14347== Syscall param ioctl(generic) points to uninitialised byte(s)
==14347==    at 0x8A57B9: ioctl (in /lib/libc-2.14.1.so)
==14347==    by 0x6A0E345: ukiCreateContext (in /usr/lib/catalyst/libatiuki.so.1.0)
==14347==    by 0xA9D4570: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xbeceacb4 is on thread 1's stack
==14347== 
==14347== Conditional jump or move depends on uninitialised value(s)
==14347==    at 0xAA46C42: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0xAA46285: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0xAA46484: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0xAA36F32: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAA7B4: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2000 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid read of size 4
==14347==    at 0xAAAA95D: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77d2000 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA8F3: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2000 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA8F7: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2010 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA8FC: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2020 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA901: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2030 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA91A: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2040 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA91F: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2050 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA924: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2060 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAA929: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb77c2070 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC2D1: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163000 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC584: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163010 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC588: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163020 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0DD: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163550 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0E3: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163554 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0E9: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb7163558 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0EF: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb716355c is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0C5: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70e9300 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0CB: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70e9304 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0D1: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70e9308 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0D7: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70e930c is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC558: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb870b78 is 3,160 bytes inside a block of size 3,164 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA835931: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC418: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb897c68 is 3,160 bytes inside a block of size 3,164 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACAE9: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1600 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACAF3: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1610 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACAFD: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1620 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACB07: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1630 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACB11: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1640 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC88F: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1800 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC893: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1810 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8A2: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1820 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8A7: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1830 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8B6: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1840 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8BB: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1850 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8D0: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1860 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC8D5: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1870 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0AD: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1c00 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0B3: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1c04 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0B9: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1c08 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0BF: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1c0c is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC558: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x4F: ???
==14347==  Address 0x8aa8cb8 is 0 bytes after a block of size 80 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x3F: ???
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC09B: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1400 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0A1: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1404 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 4
==14347==    at 0xAAAC0A7: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1408 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACADF: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1000 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC418: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x63010100: ???
==14347==  Address 0x89c6d58 is 0 bytes after a block of size 224 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC508: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x63010100: ???
==14347==  Address 0xbe44b08 is 0 bytes after a block of size 384 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAACAD5: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1100 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC698: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xbefdb08 is 3,240 bytes inside a block of size 3,244 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Syscall param ioctl(generic) points to uninitialised byte(s)
==14347==    at 0x8A57B9: ioctl (in /lib/libc-2.14.1.so)
==14347==    by 0xA9DCE45: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x8A1AA8F: ???
==14347==  Address 0xbecf8984 is on thread 1's stack
==14347== 
==14347== Syscall param ioctl(generic) points to uninitialised byte(s)
==14347==    at 0x8A57B9: ioctl (in /lib/libc-2.14.1.so)
==14347==    by 0xA9DD354: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xbecf89f0 is on thread 1's stack
==14347== 
==14347== Invalid read of size 8
==14347==    at 0xAAAC558: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x63010100: ???
==14347==  Address 0xc7c1288 is 0 bytes after a block of size 3,568 alloc'd
==14347==    at 0x400AE44: malloc (vg_replace_malloc.c:270)
==14347==    by 0xA9A33CE: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==    by 0x63010100: ???
==14347== 
==14347== Invalid write of size 4
==14347==    at 0x9BDC84A: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb70c1a00 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Conditional jump or move depends on uninitialised value(s)
==14347==    at 0x938F092: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Conditional jump or move depends on uninitialised value(s)
==14347==    at 0x93B9F10: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC764: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb6ec2010 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC768: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb6ec2020 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Conditional jump or move depends on uninitialised value(s)
==14347==    at 0x9F83794: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC4E4: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb6ec2210 is not stack'd, malloc'd or (recently) free'd
==14347== 
==14347== Invalid write of size 8
==14347==    at 0xAAAC4E8: ??? (in /usr/lib/dri/fglrx_dri.so)
==14347==  Address 0xb6ec2220 is not stack'd, malloc'd or (recently) free'd
==14347== 

I am well aware that these reads/writes are undefined behavior, and that ATI has a reputation of bad drivers on linux.

The question is, should I worry about these errors? I know that valgrind sometimes reports false problems.

like image 587
BЈовић Avatar asked Nov 12 '22 06:11

BЈовић


1 Answers

Valgrind can give false positives, especially on reads. This often occurs when copying a structure as a block memory, e.g with memcopy, because of padding bytes. If the read is inside an allocated block, this is generally ok. Reads from freed memory are not.

Invalid writes are generally a problem though.

In this case, because this is a driver, I suspect that these are to do with Direct Memory Access/memory mapped I/O, hence the "not stack'd, malloc'd or (recently) free'd" and so are ok.

like image 56
parkydr Avatar answered Dec 06 '22 08:12

parkydr