Bug 255987 - Allow suppressions based on origins tracking
Summary: Allow suppressions based on origins tracking
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (other bugs)
Version First Reported In: 3.6.0
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-03 18:59 UTC by Bartosz Taudul
Modified: 2016-05-15 21:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Taudul 2010-11-03 18:59:20 UTC
In some configurations, simple suppressions are not enough to ignore some errors without false positives.

Consider the following code:
#include <stdio.h>
#include <SDL.h>
#include <GL/gl.h>

int main()
{
        int size;

        SDL_Init( SDL_INIT_VIDEO );
        SDL_SetVideoMode( 64, 64, 24, SDL_OPENGL );

        glGetIntegerv( GL_MAX_TEXTURE_SIZE, &size );

        if( size )  /* error here */
        {
                printf( "%i\n", size );
        }

        return 0;
}

When run, it executes correctly:
% ./a.out
8192

On a sane OpenGL implementation valgrind doesn't report any errors:
% LIBGL_ALWAYS_INDIRECT=1 DISPLAY=192.168.1.2:0 valgrind ./a.out
==2238== Memcheck, a memory error detector
==2238== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2238== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==2238== Command: ./a.out
==2238==
8192
==2238==
==2238== HEAP SUMMARY:
(...)

But when the application uses VirtualBox host 3D acceleration, the fun begins:
==2225== Conditional jump or move depends on uninitialised value(s)
==2225==    at 0x804857F: main (dupa.c:14)

The only suppression valgrind can generate is:
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:main
}

Which is obviously too broad. Only the origin tracking can be used to eliminate the culprit:
==2225==  Uninitialised value was created by a heap allocation
==2225==    at 0x4024733: malloc (vg_replace_malloc.c:236)
==2225==    by 0x4B3EF9C: crAlloc (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLcrutil.so)
==2225==    by 0x4B4A1EB: crVBoxHGCMConnection (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLcrutil.so)
==2225==    by 0x4B3F459: ??? (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLcrutil.so)
==2225==    by 0x4B3F622: crNetConnectToServer (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLcrutil.so)
==2225==    by 0x4B40106: crNetServerConnect (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLcrutil.so)
==2225==    by 0x4B8253A: packspuConnectToServer (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLpackspu.so)
==2225==    by 0x4B80D71: packspuNewThread (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLpackspu.so)
==2225==    by 0x4B817A1: ??? (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGLpackspu.so)
==2225==    by 0x4AF3D5E: crSPULoad (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGL.so)
==2225==    by 0x4AF3E45: crSPULoadChain (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGL.so)
==2225==    by 0x4ABEF43: stubInit (in /opt/VBoxGuestAdditions-3.2.10/lib/VBoxOGL.so)

It would be quite helpful, if valgrind was able to generate suppressions that take the origin tracking into account.
Comment 1 Phenom 2016-05-15 21:07:55 UTC
+1
Could be merged with this BR#280974
https://bugs.kde.org/show_bug.cgi?id=280974