Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32229

Memory leaks while using ephemeral certificates

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • None
    • N/A
    • SSL
    • None

    Description

      MariaDB [(none)]> flush ssl;
      Query OK, 0 rows affected (0,477 sec)
      MariaDB [(none)]> flush ssl;
      Query OK, 0 rows affected (0,086 sec)
      shutdown;
      

      =================================================================
      ==2720518==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 9856 byte(s) in 28 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4ddac0d in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x17bc0d)
       
      Indirect leak of 225336 byte(s) in 1298 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4ddac0d in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x17bc0d)
       
      Indirect leak of 14728 byte(s) in 28 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4cfb94a  (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x9c94a)
       
      Indirect leak of 14336 byte(s) in 28 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4cec35e in ASN1_item_sign_ctx (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x8d35e)
       
      Indirect leak of 8736 byte(s) in 84 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4d1b34b in BN_MONT_CTX_new (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0xbc34b)
       
      Indirect leak of 3456 byte(s) in 54 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4ddac0d in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x17bc0d)
          #2 0x558c3f7f9fcb in vio_set_cert_stuff /11.3/src/vio/viosslfactories.c:157
          #3 0x558c3f7fb6be in new_VioSSLFd /11.3/src/vio/viosslfactories.c:408
          #4 0x558c3f7fbb42 in new_VioSSLAcceptorFd /11.3/src/vio/viosslfactories.c:496
          #5 0x558c3e5e1a6f in reinit_ssl() /11.3/src/sql/mysqld.cc:4759
          #6 0x558c3ef153f8 in reload_acl_and_cache(THD*, unsigned long long, TABLE_LIST*, int*) /11.3/src/sql/sql_reload.cc:424
          #7 0x558c3e9ac1eb in mysql_execute_command(THD*, bool) /11.3/src/sql/sql_parse.cc:5190
          #8 0x558c3e9bd701 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /11.3/src/sql/sql_parse.cc:7734
          #9 0x558c3e995356 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /11.3/src/sql/sql_parse.cc:1893
          #10 0x558c3e99209b in do_command(THD*, bool) /11.3/src/sql/sql_parse.cc:1406
          #11 0x558c3ee72676 in do_handle_one_connection(CONNECT*, bool) /11.3/src/sql/sql_connect.cc:1445
          #12 0x558c3ee71fd3 in handle_one_connection /11.3/src/sql/sql_connect.cc:1347
          #13 0x558c3fae1a63 in pfs_spawn_thread /11.3/src/storage/perfschema/pfs.cc:2201
          #14 0x7f25e4c44608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
       
      Indirect leak of 1344 byte(s) in 84 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4cfc81d  (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x9d81d)
          #2 0x3f935cb3a0bf9fff  (<unknown module>)
       
      Indirect leak of 1176 byte(s) in 56 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4cf1ce9 in ASN1_STRING_set (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x92ce9)
       
      Indirect leak of 224 byte(s) in 56 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4d2acdf in BUF_MEM_grow (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0xcbcdf)
       
      Indirect leak of 128 byte(s) in 2 object(s) allocated from:
          #0 0x7f25e51d1808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
          #1 0x7f25e4ddac0d in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.1.1+0x17bc0d)
          #2 0x558c3f7f9fcb in vio_set_cert_stuff /11.3/src/vio/viosslfactories.c:157
          #3 0x558c3f7fb6be in new_VioSSLFd /11.3/src/vio/viosslfactories.c:408
          #4 0x558c3f7fbb42 in new_VioSSLAcceptorFd /11.3/src/vio/viosslfactories.c:496
          #5 0x558c3e5e1621 in init_ssl /11.3/src/sql/mysqld.cc:4710
          #6 0x558c3e5e5a26 in mysqld_main(int, char**) /11.3/src/sql/mysqld.cc:5884
          #7 0x558c3e5cd2cc in main /11.3/src/sql/main.cc:34
          #8 0x7f25e471a082 in __libc_start_main ../csu/libc-start.c:308
       
      SUMMARY: AddressSanitizer: 279320 byte(s) leaked in 1718 allocation(s).
      

      Attachments

        Issue Links

          Activity

            Where and how was this fixed? I just observed the following:

            10.6 740519e15acbbc116cea517e927bb2bd31d12e10

            CURRENT_TEST: encryption.innodb_onlinealter_encryption
            $ /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd --defaults-group-suffix=.1 --defaults-file=/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/var/30/my.cnf --log-output=file --plugin-load-add=file_key_management.so --loose-file-key-management --loose-file-key-management-filename=/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/std_data/keys.txt --file-key-management-encryption-algorithm=aes_ctr --skip-innodb-read-only-compressed --innodb --innodb-cmpmem --innodb-cmp-per-index --innodb-trx --innodb-locks --innodb-lock-waits --innodb-metrics --innodb-buffer-pool-stats --innodb-buffer-page --innodb-buffer-page-lru --innodb-sys-columns --innodb-sys-fields --innodb-sys-foreign --innodb-sys-foreign-cols --innodb-sys-indexes --innodb-sys-tables --innodb-sys-virtual --innodb-encrypt-tables=ON --innodb-encrypt-log=ON --innodb-encryption-rotate-key-age=15 --innodb-encryption-threads=4 --innodb-tablespaces-encryption --core-file --loose-debug-sync-timeout=300
            Version: '10.6.20-MariaDB-log'  socket: '/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/var/tmp/30/mysqld.1.sock'  port: 19840  Source distribution
            2024-10-17  6:35:06 0 [Note] /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd (initiated by: root[root] @ localhost []): Normal shutdown
            2024-10-17  6:35:06 0 [Note] InnoDB: FTS optimize thread exiting.
            2024-10-17  6:35:06 0 [Note] InnoDB: Starting shutdown...
            2024-10-17  6:35:06 0 [Note] InnoDB: Dumping buffer pool(s) to /dev/shm/var_auto_rYvS/30/mysqld.1/data/ib_buffer_pool
            2024-10-17  6:35:06 0 [Note] InnoDB: Restricted to 126 pages due to innodb_buf_pool_dump_pct=25
            2024-10-17  6:35:06 0 [Note] InnoDB: Buffer pool(s) dump completed at 241017  6:35:06
            2024-10-17  6:35:06 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
            2024-10-17  6:35:06 0 [Note] InnoDB: Shutdown completed; log sequence number 3456388; transaction id 76
            2024-10-17  6:35:06 0 [Note] /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd: Shutdown complete
             
             
            =================================================================
            ==33513==ERROR: LeakSanitizer: detected memory leaks
             
            Direct leak of 904 byte(s) in 1 object(s) allocated from:
                #0 0x7f35794869cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
                #1 0x7f3578e5c018 in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.3+0x233018)
             
            SUMMARY: AddressSanitizer: 904 byte(s) leaked in 1 allocation(s).
            

            marko Marko Mäkelä added a comment - Where and how was this fixed? I just observed the following : 10.6 740519e15acbbc116cea517e927bb2bd31d12e10 CURRENT_TEST: encryption.innodb_onlinealter_encryption $ /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd --defaults-group-suffix=.1 --defaults-file=/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/var/30/my.cnf --log-output=file --plugin-load-add=file_key_management.so --loose-file-key-management --loose-file-key-management-filename=/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/std_data/keys.txt --file-key-management-encryption-algorithm=aes_ctr --skip-innodb-read-only-compressed --innodb --innodb-cmpmem --innodb-cmp-per-index --innodb-trx --innodb-locks --innodb-lock-waits --innodb-metrics --innodb-buffer-pool-stats --innodb-buffer-page --innodb-buffer-page-lru --innodb-sys-columns --innodb-sys-fields --innodb-sys-foreign --innodb-sys-foreign-cols --innodb-sys-indexes --innodb-sys-tables --innodb-sys-virtual --innodb-encrypt-tables=ON --innodb-encrypt-log=ON --innodb-encryption-rotate-key-age=15 --innodb-encryption-threads=4 --innodb-tablespaces-encryption --core-file --loose-debug-sync-timeout=300 … Version: '10.6.20-MariaDB-log' socket: '/home/buildbot/amd64-debian-12-asan-ubsan/build/mysql-test/var/tmp/30/mysqld.1.sock' port: 19840 Source distribution 2024-10-17 6:35:06 0 [Note] /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd (initiated by: root[root] @ localhost []): Normal shutdown 2024-10-17 6:35:06 0 [Note] InnoDB: FTS optimize thread exiting. 2024-10-17 6:35:06 0 [Note] InnoDB: Starting shutdown... 2024-10-17 6:35:06 0 [Note] InnoDB: Dumping buffer pool(s) to /dev/shm/var_auto_rYvS/30/mysqld.1/data/ib_buffer_pool 2024-10-17 6:35:06 0 [Note] InnoDB: Restricted to 126 pages due to innodb_buf_pool_dump_pct=25 2024-10-17 6:35:06 0 [Note] InnoDB: Buffer pool(s) dump completed at 241017 6:35:06 2024-10-17 6:35:06 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2024-10-17 6:35:06 0 [Note] InnoDB: Shutdown completed; log sequence number 3456388; transaction id 76 2024-10-17 6:35:06 0 [Note] /home/buildbot/amd64-debian-12-asan-ubsan/build/sql/mariadbd: Shutdown complete     ================================================================= ==33513==ERROR: LeakSanitizer: detected memory leaks   Direct leak of 904 byte(s) in 1 object(s) allocated from: #0 0x7f35794869cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x7f3578e5c018 in CRYPTO_zalloc (/lib/x86_64-linux-gnu/libcrypto.so.3+0x233018)   SUMMARY: AddressSanitizer: 904 byte(s) leaked in 1 allocation(s).

            it was discovered before the feature went into a main branch, so the fix was squashed into the main feature commit

            serg Sergei Golubchik added a comment - it was discovered before the feature went into a main branch, so the fix was squashed into the main feature commit

            People

              serg Sergei Golubchik
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.