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

LSAN: LeakSanitizer: detected memory leaks in operator new

    XMLWordPrintable

Details

    Description

      SELECT * FROM information_schema.all_plugins;
      SHUTDOWN;
      

      Leads to:

      CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang)

      ==3697323==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 240 byte(s) in 1 object(s) allocated from:
          #0 0x55f3d83d0131 in operator new(unsigned long) (/test/UBASAN_MD191224-mariadb-11.8.0-linux-x86_64-dbg/bin/mariadbd+0x42ed131) (BuildId: 6806f131f56caa3fd079d953e4400ba5ec496093)
          #1 0x14edcd65d731  (<unknown module>)
          #2 0x14edcd65d6bc  (<unknown module>)
          #3 0x14edcd2a4a01  (<unknown module>)
          #4 0x14edcca64afe  (<unknown module>)
          #5 0x14edcb75e489  (<unknown module>)
          #6 0x14edcb46cb6b  (<unknown module>)
          #7 0x14edcb47a17b  (<unknown module>)
          #8 0x14edffa4c71e in call_init elf/dl-init.c:74:3
          #9 0x14edffa4c823 in call_init elf/dl-init.c:120:14
          #10 0x14edffa4c823 in _dl_init elf/dl-init.c:121:5
          #11 0x14edffa485b1 in _dl_catch_exception elf/dl-catch.c:211:7
          #12 0x14edffa53d7b in dl_open_worker elf/dl-open.c:829:5
          #13 0x14edffa53d7b in dl_open_worker elf/dl-open.c:792:1
          #14 0x14edffa4851b in _dl_catch_exception elf/dl-catch.c:237:8
          #15 0x14edffa54163 in _dl_open elf/dl-open.c:905:17
          #16 0x14edff098193 in dlopen_doit dlfcn/dlopen.c:56:15
          #17 0x14edffa4851b in _dl_catch_exception elf/dl-catch.c:237:8
          #18 0x14edffa48668 in _dl_catch_error elf/dl-catch.c:256:19
          #19 0x14edff097c72 in _dlerror_run dlfcn/dlerror.c:138:17
          #20 0x14edff09824e in dlopen_implementation dlfcn/dlopen.c:71:10
          #21 0x14edff09824e in dlopen dlfcn/dlopen.c:81:12
          #22 0x55f3d8357533 in dlopen (/test/UBASAN_MD191224-mariadb-11.8.0-linux-x86_64-dbg/bin/mariadbd+0x4274533) (BuildId: 6806f131f56caa3fd079d953e4400ba5ec496093)
          #23 0x55f3d93f46d3 in plugin_dl_add(st_mysql_const_lex_string const*, unsigned long) /test/11.8_dbg_san/sql/sql_plugin.cc:778:27
          #24 0x55f3d93f3512 in plugin_dl_foreach(THD*, st_mysql_const_lex_string const*, char (*)(THD*, st_plugin_int**, void*), void*) /test/11.8_dbg_san/sql/sql_plugin.cc:2599:30
          #25 0x55f3d99e4fe6 in fill_all_plugins(THD*, TABLE_LIST*, Item*) /test/11.8_dbg_san/sql/sql_show.cc:426:9
          #26 0x55f3d9af638c in get_schema_tables_result(JOIN*, enum_schema_table_state) /test/11.8_dbg_san/sql/sql_show.cc:9689:11
          #27 0x55f3d971669e in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:4998:7
          #28 0x55f3d971056a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8
          #29 0x55f3d95aea79 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/11.8_dbg_san/sql/sql_select.cc:5353:21
          #30 0x55f3d95aa137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10
          #31 0x55f3d9295ee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12
          #32 0x55f3d9235dcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12
       
      SUMMARY: AddressSanitizer: 240 byte(s) leaked in 1 allocation(s).
      

      CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang)

      ==3697282==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 240 byte(s) in 1 object(s) allocated from:
          #0 0x55989b335641 in operator new(unsigned long) (/test/UBASAN_MD191224-mariadb-11.8.0-linux-x86_64-opt/bin/mariadbd+0x1edd641) (BuildId: d6d823bd2afe91e8ccd044c6ac5d703cff561672)
          #1 0x1519774a58b0  (<unknown module>)
          #2 0x1519772be2ce  (<unknown module>)
          #3 0x151976ecc134  (<unknown module>)
          #4 0x15197647e80e  (<unknown module>)
          #5 0x1519a6d1471e in call_init elf/dl-init.c:74:3
          #6 0x1519a6d14823 in call_init elf/dl-init.c:120:14
          #7 0x1519a6d14823 in _dl_init elf/dl-init.c:121:5
          #8 0x1519a6d105b1 in _dl_catch_exception elf/dl-catch.c:211:7
          #9 0x1519a6d1bd7b in dl_open_worker elf/dl-open.c:829:5
          #10 0x1519a6d1bd7b in dl_open_worker elf/dl-open.c:792:1
          #11 0x1519a6d1051b in _dl_catch_exception elf/dl-catch.c:237:8
          #12 0x1519a6d1c163 in _dl_open elf/dl-open.c:905:17
          #13 0x1519a6498193 in dlopen_doit dlfcn/dlopen.c:56:15
          #14 0x1519a6d1051b in _dl_catch_exception elf/dl-catch.c:237:8
          #15 0x1519a6d10668 in _dl_catch_error elf/dl-catch.c:256:19
          #16 0x1519a6497c72 in _dlerror_run dlfcn/dlerror.c:138:17
          #17 0x1519a649824e in dlopen_implementation dlfcn/dlopen.c:71:10
          #18 0x1519a649824e in dlopen dlfcn/dlopen.c:81:12
          #19 0x55989b2bca43 in dlopen (/test/UBASAN_MD191224-mariadb-11.8.0-linux-x86_64-opt/bin/mariadbd+0x1e64a43) (BuildId: d6d823bd2afe91e8ccd044c6ac5d703cff561672)
          #20 0x55989bab2947 in plugin_dl_add(st_mysql_const_lex_string const*, unsigned long) /test/11.8_opt_san/sql/sql_plugin.cc:778:27
          #21 0x55989bab21f4 in plugin_dl_foreach(THD*, st_mysql_const_lex_string const*, char (*)(THD*, st_plugin_int*, void*), void*) /test/11.8_opt_san/sql/sql_plugin.cc:2599:30
          #22 0x55989bd5be51 in fill_all_plugins(THD*, TABLE_LIST*, Item*) /test/11.8_opt_san/sql/sql_show.cc:426:9
          #23 0x55989bde22c1 in get_schema_tables_result(JOIN*, enum_schema_table_state) /test/11.8_opt_san/sql/sql_show.cc:9689:11
          #24 0x55989bc0da35 in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:4998:7
          #25 0x55989bc0be21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8
          #26 0x55989bb68a2b in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/11.8_opt_san/sql/sql_select.cc:5353:21
          #27 0x55989bb66c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10
          #28 0x55989ba1adac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12
          #29 0x55989b9fffc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12
          #30 0x55989b9c8c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18
          #31 0x55989b9bdb9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7
          #32 0x55989b9cba6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17
       
      SUMMARY: AddressSanitizer: 240 byte(s) leaked in 1 allocation(s).
      

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18. Ubuntu instructions:
           # Note: llvm-17-linker-tools installs /usr/lib/llvm-17/lib/LLVMgold.so, which is needed for compilation, and LLVMgold.so is no longer included in LLVM 18
           sudo apt install clang llvm-18 llvm-18-linker-tools llvm-18-runtime llvm-18-tools llvm-18-dev libstdc++-14-dev llvm-dev llvm-17-linker-tools
           sudo ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
      Compiled with: '-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++' and:
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export ASAN_OPTIONS=quarantine_size_mb=512:atexit=0:detect_invalid_pointer_pairs=3:dump_instruction_bytes=1:abort_on_error=1:allocator_may_return_null=1
      

      Bug confirmed present in:
      MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (dbg), 10.6.21 (opt), 10.11.11 (dbg), 10.11.11 (opt), 11.4.5 (dbg), 11.4.5 (opt), 11.7.1 (dbg), 11.7.1 (opt), 11.8.0 (dbg), 11.8.0 (opt)

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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