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

UBSAN: runtime error: call to function thd_decrement_pending_ops through pointer to incorrect function type

    XMLWordPrintable

Details

    Description

      export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      rm -Rf data tmp 
      mkdir tmp 
      ./scripts/mariadb-install-db --no-defaults --force --auth-root-authentication-method=normal --basedir=${PWD} --tmpdir=${PWD}/tmp --datadir=${PWD}/data
      

      Leads to:

      CS 10.6.21 2255be03952e0be7db764613956c5c66a6c1ab75 (Debug, UBASAN)

      /test/10.6_dbg_san/storage/innobase/log/log0sync.cc:388:5: runtime error: call to function thd_decrement_pending_ops through pointer to incorrect function type 'void (*)(void *)'
      /test/10.6_dbg_san/sql/sql_class.cc:5242: note: thd_decrement_pending_ops defined here
          #0 0x560de360ae53 in group_commit_lock::release(unsigned long) /test/10.6_dbg_san/storage/innobase/log/log0sync.cc:388:5
          #1 0x560de3509dcc in log_write_up_to(unsigned long, bool, bool, completion_callback const*) /test/10.6_dbg_san/storage/innobase/log/log0log.cc:739:26
          #2 0x560de3e55c80 in trx_flush_log_if_needed(unsigned long, trx_t*) /test/10.6_dbg_san/storage/innobase/trx/trx0trx.cc:1269:5
          #3 0x560de3e4c0e5 in trx_t::commit_in_memory(mtr_t const*) /test/10.6_dbg_san/storage/innobase/trx/trx0trx.cc:1488:7
          #4 0x560de3e4c0e5 in trx_t::commit_low(mtr_t*) /test/10.6_dbg_san/storage/innobase/trx/trx0trx.cc:1590:3
          #5 0x560de3e4e452 in trx_t::commit_persist() /test/10.6_dbg_san/storage/innobase/trx/trx0trx.cc:1604:3
          #6 0x560de3e4e9cc in trx_t::commit() /test/10.6_dbg_san/storage/innobase/trx/trx0trx.cc:1613:3
          #7 0x560de4386394 in dict_stats_save(dict_table_t*, unsigned long const*) /test/10.6_dbg_san/storage/innobase/dict/dict0stats.cc:3110:7
          #8 0x560de438a29c in dict_stats_update(dict_table_t*, dict_stats_upd_option_t) /test/10.6_dbg_san/storage/innobase/dict/dict0stats.cc:3779:12
          #9 0x560de2feef3a in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*, bool, trx_t*) /test/10.6_dbg_san/storage/innobase/handler/ha_innodb.cc:13322:9
          #10 0x560de2ff00ac in ha_innobase::create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.6_dbg_san/storage/innobase/handler/ha_innodb.cc:13344:10
          #11 0x560de0f6016e in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.6_dbg_san/sql/handler.cc:5616:14
          #12 0x560de0f73a0c in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*, bool) /test/10.6_dbg_san/sql/handler.cc:6082:22
          #13 0x560ddf5deefb in create_table_impl(THD*, st_ddl_log_state*, st_ddl_log_state*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*) /test/10.6_dbg_san/sql/sql_table.cc:4517:11
          #14 0x560ddf5d72b0 in mysql_create_table_no_lock(THD*, st_ddl_log_state*, st_ddl_log_state*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /test/10.6_dbg_san/sql/sql_table.cc:4617:8
          #15 0x560ddf5e4cf8 in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.6_dbg_san/sql/sql_table.cc:4839:7
          #16 0x560ddf6c9e72 in Sql_cmd_create_table_like::execute(THD*) /test/10.6_dbg_san/sql/sql_table.cc:12328:12
          #17 0x560dded0933c in mysql_execute_command(THD*, bool) /test/10.6_dbg_san/sql/sql_parse.cc:6152:26
          #18 0x560ddee4eef9 in Prepared_statement::execute(String*, bool) /test/10.6_dbg_san/sql/sql_prepare.cc:5265:14
          #19 0x560ddee22796 in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /test/10.6_dbg_san/sql/sql_prepare.cc:4671:10
          #20 0x560ddee1fa02 in mysql_sql_stmt_execute(THD*) /test/10.6_dbg_san/sql/sql_prepare.cc:3697:16
          #21 0x560ddecb4ea7 in mysql_execute_command(THD*, bool) /test/10.6_dbg_san/sql/sql_parse.cc:4015:5
          #22 0x560ddec5bed9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/10.6_dbg_san/sql/sql_parse.cc:8194:18
          #23 0x560ddec58a15 in bootstrap(st_mysql_file*) /test/10.6_dbg_san/sql/sql_parse.cc:1094:5
          #24 0x560dde111328 in mysqld_main(int, char**) /test/10.6_dbg_san/sql/mysqld.cc:5888:26
          #25 0x560dde0fb863 in main /test/10.6_dbg_san/sql/main.cc:34:10
          #26 0x1482e002a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #27 0x1482e002a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #28 0x560dde020034 in _start (/test/UBASAN_MD271124-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd+0x3eb8034) (BuildId: 3cd87cd3953ac9cf3a930328b34dbd55d44c8146)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.6_dbg_san/storage/innobase/log/log0sync.cc:388:5 
      

      Observed using UBSAN with Clang and LLMV 18.1.3:

      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  # 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 ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
      ...
      export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      

      Related helpful comment on 'function-type-mismatch' errors here.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.