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

runtime error: call to function show_cached_thread_count()/show_binlog_space_total() through pointer to incorrect function type

    XMLWordPrintable

Details

    Description

      SELECT * FROM information_schema.global_status;
      

      Leads to:

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/sql/sql_show.cc:3791:7: runtime error: call to function show_cached_thread_count(THD*, st_mysql_show_var*, char*, enum_var_type) through pointer to incorrect function type 'int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type)'
      /test/10.5_dbg_san/sql/mysqld.cc:7394: note: show_cached_thread_count(THD*, st_mysql_show_var*, char*, enum_var_type) defined here
          #0 0x55bf73cd89d0 in show_status_array(THD*, char const*, st_mysql_show_var*, enum_var_type, system_status_var*, char const*, TABLE*, bool, Item*) /test/10.5_dbg_san/sql/sql_show.cc:3791:7
          #1 0x55bf73cdd9b9 in fill_status(THD*, TABLE_LIST*, Item*) /test/10.5_dbg_san/sql/sql_show.cc:8131:8
          #2 0x55bf73cf837a in get_schema_tables_result(JOIN*, enum_schema_table_state) /test/10.5_dbg_san/sql/sql_show.cc:9011:11
          #3 0x55bf73973be9 in JOIN::exec_inner() /test/10.5_dbg_san/sql/sql_select.cc:4618:7
          #4 0x55bf7396d8d1 in JOIN::exec() /test/10.5_dbg_san/sql/sql_select.cc:4441:3
          #5 0x55bf7381c543 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/10.5_dbg_san/sql/sql_select.cc:4918:9
          #6 0x55bf738180c7 in handle_select(THD*, LEX*, select_result*, unsigned long) /test/10.5_dbg_san/sql/sql_select.cc:449:10
          #7 0x55bf735f43f0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6437:12
          #8 0x55bf7358859f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #9 0x55bf7352f4e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #10 0x55bf7350f453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #11 0x55bf73537a19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #12 0x55bf744b1f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #13 0x55bf744b06fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #14 0x55bf729aba8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #15 0x1545ee09ca93 in start_thread nptl/pthread_create.c:447:8
          #16 0x1545ee129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/sql/sql_show.cc:3791:7 
      

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18:
      # 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
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=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

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