Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-3160

LP #1334743: Numerous Valgrind errors in OpenSSL

    Details

      Description

      **Reported in Launchpad by Laurynas Biveinis last update 30-03-2016 12:17:00

      Building server with system SSL produces numerous Valgrind errors on SSL code paths at least for 5.5:

      cmake .. -DWITH_DEBUG=ON -DWITH_VALGRIND=ON -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify -DWITH_SSL=system

      ...

      $ ./mysql-test-run percona_ssl_connections_count --valgrind
      ...
      main.percona_ssl_connections_count [ pass ] 1737
      valgrind_report [ pass ]

      Inspecting the error log we see tens of

      ==16997== 24 bytes in 1 blocks are still reachable in loss record 1 of 695
      ==16997== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16997== by 0x5B6AD32: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BF0C2A: lh_insert (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6D829: OBJ_NAME_add (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFAF74: EVP_add_cipher (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x58F0B80: SSL_library_init (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
      ==16997== by 0xC126F0: check_ssl_init (viosslfactories.c:155)
      ==16997== by 0xC127E8: new_VioSSLFd (viosslfactories.c:186)
      ==16997== by 0xC12C89: new_VioSSLAcceptorFd (viosslfactories.c:306)
      ==16997== by 0x555095: init_ssl() (mysqld.cc:3799)
      ==16997== by 0x556AB9: mysqld_main(int, char**) (mysqld.cc:4755)
      ==16997== by 0x54E27C: main (main.cc:25)

      followed by hundreds of

      ==16997== 24 bytes in 1 blocks are still reachable in loss record 65 of 695
      ==16997== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16997== by 0x5B6AD32: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6D806: OBJ_NAME_add (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFAF74: EVP_add_cipher (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFEF00: OpenSSL_add_all_ciphers (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFEEDD: OPENSSL_add_all_algorithms_noconf (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0xC126F5: check_ssl_init (viosslfactories.c:156)
      ==16997== by 0xC127E8: new_VioSSLFd (viosslfactories.c:186)
      ==16997== by 0xC12C89: new_VioSSLAcceptorFd (viosslfactories.c:306)
      ==16997== by 0x555095: init_ssl() (mysqld.cc:3799)
      ==16997== by 0x556AB9: mysqld_main(int, char**) (mysqld.cc:4755)
      ==16997== by 0x54E27C: main (main.cc:25)

      followed by tens of

      ==16997== 24 bytes in 1 blocks are still reachable in loss record 423 of 695
      ==16997== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16997== by 0x5B6AD32: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6D806: OBJ_NAME_add (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFAFC7: EVP_add_digest (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BFF610: OpenSSL_add_all_digests (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0xC126F5: check_ssl_init (viosslfactories.c:156)
      ==16997== by 0xC127E8: new_VioSSLFd (viosslfactories.c:186)
      ==16997== by 0xC12C89: new_VioSSLAcceptorFd (viosslfactories.c:306)
      ==16997== by 0x555095: init_ssl() (mysqld.cc:3799)
      ==16997== by 0x556AB9: mysqld_main(int, char**) (mysqld.cc:4755)
      ==16997== by 0x54E27C: main (main.cc:25)

      followed by a few of

      ==16997== 24 bytes in 1 blocks are still reachable in loss record 493 of 695
      ==16997== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16997== by 0x5B6AD32: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6C0A5: def_get_class (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6C1D3: int_get_new_index (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x58E7264: SSL_get_ex_data_X509_STORE_CTX_idx (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
      ==16997== by 0x58E4336: SSL_CTX_new (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)
      ==16997== by 0xC12837: new_VioSSLFd (viosslfactories.c:192)
      ==16997== by 0xC12C89: new_VioSSLAcceptorFd (viosslfactories.c:306)
      ==16997== by 0x555095: init_ssl() (mysqld.cc:3799)
      ==16997== by 0x556AB9: mysqld_main(int, char**) (mysqld.cc:4755)
      ==16997== by 0x54E27C: main (main.cc:25)

      and

      ==16997== 24 bytes in 1 blocks are still reachable in loss record 499 of 695
      ==16997== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16997== by 0x5B6AD32: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6C0A5: def_get_class (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5B6CA4A: int_new_ex_data (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BE74C3: BIO_set (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BE7541: BIO_new (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5BE93B3: BIO_new_file (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5C2DA43: X509_load_cert_crl_file (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5C2DB8C: by_file_ctrl (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0x5C24F0E: X509_STORE_load_locations (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
      ==16997== by 0xC12972: new_VioSSLFd (viosslfactories.c:220)
      ==16997== by 0xC12C89: new_VioSSLAcceptorFd (viosslfactories.c:306)
      ==16997== by 0x555095: init_ssl() (mysqld.cc:3799)
      ==16997== by 0x556AB9: mysqld_main(int, char**) (mysqld.cc:4755)
      ==16997== by 0x54E27C: main (main.cc:25)

      etc.

      This can be fixed by backporting lp:mysql-server revisions 3902.124.81 and 3902.150.19.

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lpjirasync lpjirasync (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: