]> git.ipfire.org Git - thirdparty/squid.git/commit
Hide OpenSSL tricks from Valgrind far-reaching initialization errors.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 6 Oct 2016 00:05:38 +0000 (18:05 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 6 Oct 2016 00:05:38 +0000 (18:05 -0600)
commitafc199f98b6d102670e4dae51e3fc1795f7d6edd
tree4283a1d1d309bb16b25d50f937bd9905d90bbd4a
parent27534aa04f9b5c494bccc1d2a378190c3d44512e
Hide OpenSSL tricks from Valgrind far-reaching initialization errors.

This change has no effect unless ./configured --with-valgrind-debug.

OpenSSL, including its Assembly code, contains many optimizations and
timing defenses that Valgrind misinterprets as uninitialized value
usage. Most of those tricks can be disabled by #defining PURIFY when
building OpenSSL, but some are not protected with PURIFY and most
OpenSSL libraries are (and should be) built without that #define.

To make matters worse, once Valgrind misdetects uninitialized memory, it
will complain about every usage of that memory. Those complaints create
a lot of noise, complicate triage, and effectively mask true bugs.
AFAICT, they cannot be suppressed by listing the source of that memory.

For example, this OpenSSL Assembly trick:
    Uninitialised value was created by a stack allocation
       at 0x556C2F7: aesni_cbc_encrypt (aesni-x86_64.s:2081)

Triggers many false errors like this one:
    Conditional jump or move depends on uninitialised value(s)
       by 0x750838: Debug::Finish()
       by 0x942E68: Http::One::ResponseParser::parse(SBuf const&)
       ...

This change marks OpenSSL-returned decrypted bytes as initialized. This
might miss some true OpenSSL bugs, but we should focus on Squid bugs.
src/ssl/support.cc