valgrind support

Damien Miller djm at mindrot.org
Fri Feb 27 10:08:07 AEDT 2015


Hi,

I just pushed valgrind support for the regression and unit tests. If you
run "make tests USE_VALGRIND=1" then almost all the tests will be run
under valgrind.

The valgrind output is dumped in regress/valgrind-out with a file per
{ test, binary, PID }. There is no analysis or summarisation yet (want
to help? write a summarisation script)

Some warnings:

First, it's slow. My relatively recent laptop takes a couple of hours to
complete a test run.

Second and related to the first, any test that is borderline flaky because
of timeout-sensitiveity will be more broken with valgrind enabled.

Thirdly, there are some (AFAIK) small memory leaks. Many of these
seem to be things allocated in main() that we don't bother to clean
up (though maybe we will in the future). If you spot something 1) not
allocated in main() and 2) that isn't expected to be needed for the
life of the process then let us know - these are more important and
we'll try to fix them sooner.

Fourthly, if you are running on a CPU for which OpenSSL enables AES-NI
then expect a gazillion spurious memory fault errors. The gory details
of this are documented here[1], but TLDR you can avoid the spam by
telling OpenSSL not to use AES-NI:

OPENSSL_ia32cap="~0x200000000000000" make tests USE_VALGRIND=1

Finally, and most importantly. If you see any valgrind errors about
use of uninitialised memory, use-after-free or other memory faults
then please tell us and we'll fix them immediately.

Either way, if your OS is supported by valgrind then please give it a
try and report back.

-d

[1] http://rt.openssl.org/Ticket/Display.html?id=2862&user=guest&pass=guest


More information about the openssh-unix-dev mailing list