0

I am debugging a program which links against a commercial API library (under Linux). I am using valgrind memcheck, because I am experiencing strange behavior which could be due to writes beyond allocated blocks of memory:

valgrind --tool=memcheck --error-limit=no --log-file=memcheck.log ./executable

The first thing which jumps to my eye, however, are many errors of the types

Use of uninitialised value of size (4/8/16)

Invalid read of size (4/8/16)

Conditional jump or move depends on uninitialised value(s)

Some, but not all, of these occur in __intel_sse2_strcpy or __intel_sse2_strlen. Furthermore, according to valgrind there are definite memory leaks. which appear in the library. They also appear when I compile one of the examples that ship with the library, so they are not my programming errors. Furthermore, they consistently occur with different versions of the library. Since the library is closed-source I cannot seem to clarify if the errors are fatal or not.

Practically this makes it hard for me to identify my potential own errors. I am a bit surprised to see so many warnings because I tend to fix my own programs until memcheck does not print these anymore (before I give it away at least). The question is: Can I consider such errors as save to ignore, do they commonly appear in packaged software, or are they likely even false positives (for instance because the library was compiled with optimizations)?

highsciguy
  • 2,569
  • 3
  • 34
  • 59
  • 1
    You should, obviously, take this up with your vendor's technical support. – unwind Feb 26 '15 at 11:50
  • Yes, but I don't expect a lot of true help from this side (empircally), even though the mathematical library we talk about is an expensive product. – highsciguy Feb 26 '15 at 12:04
  • 1
    [How do you tell Valgrind to completely suppress a particular .so file?](http://stackoverflow.com/questions/2375726/how-do-you-tell-valgrind-to-completely-suppress-a-particular-so-file) – David Ranieri Feb 26 '15 at 12:12
  • Thanks, that might be helpful. However, the problem I am having, if so, would likely appear in the same library. – highsciguy Feb 26 '15 at 12:27

2 Answers2

0

I would say:

  1. No, you can't consider them safe to ignore. Valgrind is good.
  2. Yes, they can be pretty common if the original developers have never used Valgrind or a similar tool on their code, it's reasonable to expect some hits.
  3. I don't think they are false posivives, such are rare.
unwind
  • 391,730
  • 64
  • 469
  • 606
0

Quoting an answer from here which might explains the false positives encountered in string operations:

https://www.intel.com/content/www/us/en/developer/articles/troubleshooting/false-positive-diagnostic-on-string-operations-reported-by-intel-inspector.html

''' there are certain string operations that use vector(SIMD) instructions to calculate the string length. They read a string pointer in 32 byte chunks and check for a NULL character in each chunk that it reads. If the string size is not a multiple of 32, then it reads garbage in the memory region after the NULL '''

isti_spl
  • 706
  • 6
  • 10