9

I am developing application using OpenSSL API. As it known, OpenSSL uses miriades of global variables which are taken by Valgrind as errors ("conditional jump or move..." etc). Thus the Valgrind's output gets clogged with errors from shared libraries. This is very inconvenient for debug purposes, because every time I get:

More than X total errors detected. I'm not reporting any more. Final error counts will be inaccurate. Go fix your program!

The questions are:

  1. Can I disable party libraries (-lssl and -lcrypto in my case) memory checks in Valgrind?

  2. OR can I focus only on "definitly lost" errors?

    Thank you.

Community
  • 1
  • 1
Vitaly Isaev
  • 5,392
  • 6
  • 45
  • 64
  • You might like to read about Valgrind's option `--suppressions=`: http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress – alk Sep 11 '13 at 14:32

4 Answers4

17

Adding the option

--undef-value-errors=no 

works for me (hide all "Conditional jump or move depends on uninitialised value(s)").

For more information see Valgrind's man page.

VAV
  • 1,756
  • 1
  • 16
  • 26
4

Valgrind can be configured to suppress errors in libraries.

Details on this you find here: http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress

From the web-page linked above:

Note: By far the easiest way to add suppressions is to use the --gen-suppressions=yes option described in Core Command-line Options. This generates suppressions automatically. For best results, though, you may want to edit the output of --gen-suppressions=yes by hand, in which case it would be advisable to read through this section.

alk
  • 69,737
  • 10
  • 105
  • 255
2

You need to compile OpenSSL with the PURIFY flag (-DPURIFY in CFLAGS) to get rid of the errors. Do not use the version compiled that way in your final application, only for debugging purpose, because it decreases the entropy used in various places.

For example, compile OpenSSL in debug mode with :

./config -d no-static shared zlib -Wa,--noexecstack -DPURIFY -O0 -ggdb3
Remi Gacogne
  • 4,655
  • 1
  • 18
  • 22
1

Please note that you might also disable warnings generated by your own faulty code if you disable / supress all checks in OpenSSL. For example when you pass not fully initialized structures to OpenSSL functions, this can also result in "conditional jump or move..." errors and you probably want to see those.

Gene Vincent
  • 5,237
  • 9
  • 50
  • 86