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

Various UBSAN function-type-mismatch errors when using MTR in maria_open, mi_open, _ma_open_datafile, mi_open_datafile and thr_multi_lock

Details

    Description

      Create a test ./main/test.test with:

      SELECT 1;  # Unrelated query, to prevent MTR failing at startup
      

      And execute as:

      export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1; ./mtr test
      

      Leads to:

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN)

      /test/10.5_dbg_san/storage/maria/ma_open.c:352:7: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
      /test/10.5_dbg_san/sql/debug_sync.cc:1556: note: debug_sync(THD*, char const*, unsigned long) defined here
          #0 0x5631269c939c in maria_open /test/10.5_dbg_san/storage/maria/ma_open.c:352:7
          #1 0x563126834fab in ha_maria::open(char const*, int, unsigned int) /test/10.5_dbg_san/storage/maria/ha_maria.cc:1140:15
          #2 0x5631251959b2 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.5_dbg_san/sql/handler.cc:3100:7
          #3 0x563123c69baf in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.5_dbg_san/sql/table.cc:4325:33
          #4 0x5631229f7635 in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:2024:12
          #5 0x563122a24eb7 in open_and_process_table(THD*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:3819:14
          #6 0x563122a17759 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:4303:14
          #7 0x563122a4196a in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:5250:7
          #8 0x56312277cce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #9 0x56312310d98f in plugin_load(st_mem_root*) /test/10.5_dbg_san/sql/sql_plugin.cc:1897:11
          #10 0x563123108e58 in plugin_init(int*, char**, int) /test/10.5_dbg_san/sql/sql_plugin.cc:1813:5
          #11 0x5631224b1233 in init_server_components() /test/10.5_dbg_san/sql/mysqld.cc:4998:7
          #12 0x5631224a54cc in mysqld_main(int, char**) /test/10.5_dbg_san/sql/mysqld.cc:5606:7
          #13 0x563122490983 in main /test/10.5_dbg_san/sql/main.cc:25:10
          #14 0x14829a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #15 0x14829a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #16 0x5631223b5154 in _start (/test/UBASAN_MD271124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadbd+0x3ed3154) (BuildId: 5aa7dce20f8daf2d280cf24110013248ddebc1ea)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/maria/ma_open.c:352:7 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN)

      /test/10.5_dbg_san/storage/maria/ma_open.c:2057:3: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
      /test/10.5_dbg_san/sql/debug_sync.cc:1556: note: debug_sync(THD*, char const*, unsigned long) defined here
          #0 0x5631269f5bc3 in _ma_open_datafile /test/10.5_dbg_san/storage/maria/ma_open.c:2057:3
          #1 0x5631269d95e3 in maria_open /test/10.5_dbg_san/storage/maria/ma_open.c:976:13
          #2 0x563126834fab in ha_maria::open(char const*, int, unsigned int) /test/10.5_dbg_san/storage/maria/ha_maria.cc:1140:15
          #3 0x5631251959b2 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.5_dbg_san/sql/handler.cc:3100:7
          #4 0x563123c69baf in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.5_dbg_san/sql/table.cc:4325:33
          #5 0x5631229f7635 in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:2024:12
          #6 0x563122a24eb7 in open_and_process_table(THD*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:3819:14
          #7 0x563122a17759 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:4303:14
          #8 0x563122a4196a in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:5250:7
          #9 0x56312277cce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #10 0x56312310d98f in plugin_load(st_mem_root*) /test/10.5_dbg_san/sql/sql_plugin.cc:1897:11
          #11 0x563123108e58 in plugin_init(int*, char**, int) /test/10.5_dbg_san/sql/sql_plugin.cc:1813:5
          #12 0x5631224b1233 in init_server_components() /test/10.5_dbg_san/sql/mysqld.cc:4998:7
          #13 0x5631224a54cc in mysqld_main(int, char**) /test/10.5_dbg_san/sql/mysqld.cc:5606:7
          #14 0x563122490983 in main /test/10.5_dbg_san/sql/main.cc:25:10
          #15 0x14829a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #16 0x14829a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #17 0x5631223b5154 in _start (/test/UBASAN_MD271124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadbd+0x3ed3154) (BuildId: 5aa7dce20f8daf2d280cf24110013248ddebc1ea)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/maria/ma_open.c:2057:3 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN)

      /test/10.5_dbg_san/mysys/thr_lock.c:1168:3: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
      /test/10.5_dbg_san/sql/debug_sync.cc:1556: note: debug_sync(THD*, char const*, unsigned long) defined here
          #0 0x563128f1b567 in thr_multi_lock /test/10.5_dbg_san/mysys/thr_lock.c:1168:3
          #1 0x563125d793e5 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /test/10.5_dbg_san/sql/lock.cc:352:37
          #2 0x563125d70b8b in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /test/10.5_dbg_san/sql/lock.cc:304:7
          #3 0x563122a3767e in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /test/10.5_dbg_san/sql/sql_base.cc:5504:23
          #4 0x563122a41f80 in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:5259:7
          #5 0x56312277cce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #6 0x56312310d98f in plugin_load(st_mem_root*) /test/10.5_dbg_san/sql/sql_plugin.cc:1897:11
          #7 0x563123108e58 in plugin_init(int*, char**, int) /test/10.5_dbg_san/sql/sql_plugin.cc:1813:5
          #8 0x5631224b1233 in init_server_components() /test/10.5_dbg_san/sql/mysqld.cc:4998:7
          #9 0x5631224a54cc in mysqld_main(int, char**) /test/10.5_dbg_san/sql/mysqld.cc:5606:7
          #10 0x563122490983 in main /test/10.5_dbg_san/sql/main.cc:25:10
          #11 0x14829a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #12 0x14829a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #13 0x5631223b5154 in _start (/test/UBASAN_MD271124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadbd+0x3ed3154) (BuildId: 5aa7dce20f8daf2d280cf24110013248ddebc1ea)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/mysys/thr_lock.c:1168:3 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN)

      /test/10.5_dbg_san/mysys/thr_lock.c:1185:3: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
      /test/10.5_dbg_san/sql/debug_sync.cc:1556: note: debug_sync(THD*, char const*, unsigned long) defined here
          #0 0x563128f1b94d in thr_multi_lock /test/10.5_dbg_san/mysys/thr_lock.c:1185:3
          #1 0x563125d793e5 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /test/10.5_dbg_san/sql/lock.cc:352:37
          #2 0x563125d70b8b in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /test/10.5_dbg_san/sql/lock.cc:304:7
          #3 0x563122a3767e in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /test/10.5_dbg_san/sql/sql_base.cc:5504:23
          #4 0x563122a41f80 in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /test/10.5_dbg_san/sql/sql_base.cc:5259:7
          #5 0x56312277cce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #6 0x56312310d98f in plugin_load(st_mem_root*) /test/10.5_dbg_san/sql/sql_plugin.cc:1897:11
          #7 0x563123108e58 in plugin_init(int*, char**, int) /test/10.5_dbg_san/sql/sql_plugin.cc:1813:5
          #8 0x5631224b1233 in init_server_components() /test/10.5_dbg_san/sql/mysqld.cc:4998:7
          #9 0x5631224a54cc in mysqld_main(int, char**) /test/10.5_dbg_san/sql/mysqld.cc:5606:7
          #10 0x563122490983 in main /test/10.5_dbg_san/sql/main.cc:25:10
          #11 0x14829a22a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #12 0x14829a22a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #13 0x5631223b5154 in _start (/test/UBASAN_MD271124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadbd+0x3ed3154) (BuildId: 5aa7dce20f8daf2d280cf24110013248ddebc1ea)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/mysys/thr_lock.c:1185:3 
      

      Note that other unresolved UBSAN bugs from other tickets may also show besides these; only traces relevant to this ticket were left here. Note also that at the end of the log, some issues may repeat (after 'ready for connections'); check the top of the log to see all items listed here.

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18:
           # 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 UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            Additionally, on 10.11.11 we see:

            CS 10.11.11 3d23adb766607e5d404b06d3b8cd5de23ab672bb (Debug, UBASAN)

            /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
            /test/10.11_dbg_san/sql/debug_sync.cc:1758: note: debug_sync(THD*, char const*, unsigned long) defined here
                #0 0x55d81074aeea in mi_open /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5
                #1 0x55d810607b28 in ha_myisam::open(char const*, int, unsigned int) /test/10.11_dbg_san/storage/myisam/ha_myisam.cc:848:14
                #2 0x55d80cea8672 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.11_dbg_san/sql/handler.cc:3450:7
                #3 0x55d80b8a057c in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.11_dbg_san/sql/table.cc:4467:33
                #4 0x55d80c48d29d in THD::open_temporary_table(TMP_TABLE_SHARE*, char const*) /test/10.11_dbg_san/sql/temporary_tables.cc:1139:7
                #5 0x55d80c48abbe in THD::create_and_open_tmp_table(st_mysql_const_unsigned_lex_string*, char const*, char const*, char const*, bool) /test/10.11_dbg_san/sql/temporary_tables.cc:74:12
                #6 0x55d80b4fbafc 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.11_dbg_san/sql/sql_table.cc:4719:24
                #7 0x55d80b4f3891 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.11_dbg_san/sql/sql_table.cc:4807:8
                #8 0x55d80b5ee48b in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.11_dbg_san/sql/sql_table.cc:5033:7
                #9 0x55d80b5df201 in Sql_cmd_create_table_like::execute(THD*) /test/10.11_dbg_san/sql/sql_table.cc:12889:12
                #10 0x55d80ab398c2 in mysql_execute_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:6153:26
                #11 0x55d80aa8be59 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/10.11_dbg_san/sql/sql_parse.cc:8174:18
                #12 0x55d80aa6d4ec in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1906:7
                #13 0x55d80aa95db6 in do_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1419:17
                #14 0x55d80bba0e56 in do_handle_one_connection(CONNECT*, bool) /test/10.11_dbg_san/sql/sql_connect.cc:1386:11
                #15 0x55d80bb9f61d in handle_one_connection /test/10.11_dbg_san/sql/sql_connect.cc:1298:5
                #16 0x55d809c4a5cc in asan_thread_start(void*) asan_interceptors.cpp.o
                #17 0x15322449ca93 in start_thread nptl/pthread_create.c:447:8
                #18 0x153224529c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch 
            

            CS 10.11.11 3d23adb766607e5d404b06d3b8cd5de23ab672bb (Debug, UBASAN)

            /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5 
            /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)'
            /test/10.11_dbg_san/sql/debug_sync.cc:1758: note: debug_sync(THD*, char const*, unsigned long) defined here
                #0 0x55d810774604 in mi_open_datafile /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3
                #1 0x55d810755f6f in mi_open /test/10.11_dbg_san/storage/myisam/mi_open.c:514:9
                #2 0x55d810607b28 in ha_myisam::open(char const*, int, unsigned int) /test/10.11_dbg_san/storage/myisam/ha_myisam.cc:848:14
                #3 0x55d80cea8672 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.11_dbg_san/sql/handler.cc:3450:7
                #4 0x55d80b8a057c in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.11_dbg_san/sql/table.cc:4467:33
                #5 0x55d80c48d29d in THD::open_temporary_table(TMP_TABLE_SHARE*, char const*) /test/10.11_dbg_san/sql/temporary_tables.cc:1139:7
                #6 0x55d80c48abbe in THD::create_and_open_tmp_table(st_mysql_const_unsigned_lex_string*, char const*, char const*, char const*, bool) /test/10.11_dbg_san/sql/temporary_tables.cc:74:12
                #7 0x55d80b4fbafc 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.11_dbg_san/sql/sql_table.cc:4719:24
                #8 0x55d80b4f3891 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.11_dbg_san/sql/sql_table.cc:4807:8
                #9 0x55d80b5ee48b in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.11_dbg_san/sql/sql_table.cc:5033:7
                #10 0x55d80b5df201 in Sql_cmd_create_table_like::execute(THD*) /test/10.11_dbg_san/sql/sql_table.cc:12889:12
                #11 0x55d80ab398c2 in mysql_execute_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:6153:26
                #12 0x55d80aa8be59 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/10.11_dbg_san/sql/sql_parse.cc:8174:18
                #13 0x55d80aa6d4ec in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1906:7
                #14 0x55d80aa95db6 in do_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1419:17
                #15 0x55d80bba0e56 in do_handle_one_connection(CONNECT*, bool) /test/10.11_dbg_san/sql/sql_connect.cc:1386:11
                #16 0x55d80bb9f61d in handle_one_connection /test/10.11_dbg_san/sql/sql_connect.cc:1298:5
                #17 0x55d809c4a5cc in asan_thread_start(void*) asan_interceptors.cpp.o
                #18 0x15322449ca93 in start_thread nptl/pthread_create.c:447:8
                #19 0x153224529c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3 
            

            Roel Roel Van de Paar added a comment - - edited Additionally, on 10.11.11 we see: CS 10.11.11 3d23adb766607e5d404b06d3b8cd5de23ab672bb (Debug, UBASAN) /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)' /test/10.11_dbg_san/sql/debug_sync.cc:1758: note: debug_sync(THD*, char const*, unsigned long) defined here #0 0x55d81074aeea in mi_open /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5 #1 0x55d810607b28 in ha_myisam::open(char const*, int, unsigned int) /test/10.11_dbg_san/storage/myisam/ha_myisam.cc:848:14 #2 0x55d80cea8672 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.11_dbg_san/sql/handler.cc:3450:7 #3 0x55d80b8a057c in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.11_dbg_san/sql/table.cc:4467:33 #4 0x55d80c48d29d in THD::open_temporary_table(TMP_TABLE_SHARE*, char const*) /test/10.11_dbg_san/sql/temporary_tables.cc:1139:7 #5 0x55d80c48abbe in THD::create_and_open_tmp_table(st_mysql_const_unsigned_lex_string*, char const*, char const*, char const*, bool) /test/10.11_dbg_san/sql/temporary_tables.cc:74:12 #6 0x55d80b4fbafc 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.11_dbg_san/sql/sql_table.cc:4719:24 #7 0x55d80b4f3891 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.11_dbg_san/sql/sql_table.cc:4807:8 #8 0x55d80b5ee48b in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.11_dbg_san/sql/sql_table.cc:5033:7 #9 0x55d80b5df201 in Sql_cmd_create_table_like::execute(THD*) /test/10.11_dbg_san/sql/sql_table.cc:12889:12 #10 0x55d80ab398c2 in mysql_execute_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:6153:26 #11 0x55d80aa8be59 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/10.11_dbg_san/sql/sql_parse.cc:8174:18 #12 0x55d80aa6d4ec in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1906:7 #13 0x55d80aa95db6 in do_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1419:17 #14 0x55d80bba0e56 in do_handle_one_connection(CONNECT*, bool) /test/10.11_dbg_san/sql/sql_connect.cc:1386:11 #15 0x55d80bb9f61d in handle_one_connection /test/10.11_dbg_san/sql/sql_connect.cc:1298:5 #16 0x55d809c4a5cc in asan_thread_start(void*) asan_interceptors.cpp.o #17 0x15322449ca93 in start_thread nptl/pthread_create.c:447:8 #18 0x153224529c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch CS 10.11.11 3d23adb766607e5d404b06d3b8cd5de23ab672bb (Debug, UBASAN) /test/10.11_dbg_san/storage/myisam/mi_open.c:140:5 /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)' /test/10.11_dbg_san/sql/debug_sync.cc:1758: note: debug_sync(THD*, char const*, unsigned long) defined here #0 0x55d810774604 in mi_open_datafile /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3 #1 0x55d810755f6f in mi_open /test/10.11_dbg_san/storage/myisam/mi_open.c:514:9 #2 0x55d810607b28 in ha_myisam::open(char const*, int, unsigned int) /test/10.11_dbg_san/storage/myisam/ha_myisam.cc:848:14 #3 0x55d80cea8672 in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.11_dbg_san/sql/handler.cc:3450:7 #4 0x55d80b8a057c in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /test/10.11_dbg_san/sql/table.cc:4467:33 #5 0x55d80c48d29d in THD::open_temporary_table(TMP_TABLE_SHARE*, char const*) /test/10.11_dbg_san/sql/temporary_tables.cc:1139:7 #6 0x55d80c48abbe in THD::create_and_open_tmp_table(st_mysql_const_unsigned_lex_string*, char const*, char const*, char const*, bool) /test/10.11_dbg_san/sql/temporary_tables.cc:74:12 #7 0x55d80b4fbafc 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.11_dbg_san/sql/sql_table.cc:4719:24 #8 0x55d80b4f3891 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.11_dbg_san/sql/sql_table.cc:4807:8 #9 0x55d80b5ee48b in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.11_dbg_san/sql/sql_table.cc:5033:7 #10 0x55d80b5df201 in Sql_cmd_create_table_like::execute(THD*) /test/10.11_dbg_san/sql/sql_table.cc:12889:12 #11 0x55d80ab398c2 in mysql_execute_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:6153:26 #12 0x55d80aa8be59 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/10.11_dbg_san/sql/sql_parse.cc:8174:18 #13 0x55d80aa6d4ec in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1906:7 #14 0x55d80aa95db6 in do_command(THD*, bool) /test/10.11_dbg_san/sql/sql_parse.cc:1419:17 #15 0x55d80bba0e56 in do_handle_one_connection(CONNECT*, bool) /test/10.11_dbg_san/sql/sql_connect.cc:1386:11 #16 0x55d80bb9f61d in handle_one_connection /test/10.11_dbg_san/sql/sql_connect.cc:1298:5 #17 0x55d809c4a5cc in asan_thread_start(void*) asan_interceptors.cpp.o #18 0x15322449ca93 in start_thread nptl/pthread_create.c:447:8 #19 0x153224529c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.11_dbg_san/storage/myisam/mi_open.c:1273:3
            Roel Roel Van de Paar added a comment - - edited

            UBSAN Supression filter added (will be removed once fixed):

            ## MDEV-35687 [Startup]
            function:maria_open
            function:mi_open
            function:_ma_open_datafile
            function:mi_open_datafile
            function:thr_multi_lock
            

            Roel Roel Van de Paar added a comment - - edited UBSAN Supression filter added (will be removed once fixed): ## MDEV-35687 [Startup] function :maria_open function :mi_open function :_ma_open_datafile function :mi_open_datafile function :thr_multi_lock

            This should be related to the following:

            #ifdef __cplusplus
            class THD;
            class Item;
            #define MYSQL_THD THD*
            #else
            #define MYSQL_THD void*
            #endif
            

            It would seem that the function pointer signature needs to be defined consistently to use void* instead of THD*, and the implementation has to conform to this signature. Somehow this is not being caught at compilation time by the changes that were implemented in MDEV-34348.

            marko Marko Mäkelä added a comment - This should be related to the following: #ifdef __cplusplus class THD; class Item; #define MYSQL_THD THD* #else #define MYSQL_THD void* #endif It would seem that the function pointer signature needs to be defined consistently to use void* instead of THD* , and the implementation has to conform to this signature. Somehow this is not being caught at compilation time by the changes that were implemented in MDEV-34348 .

            Thank you marko for the quick analysis!

            Roel Roel Van de Paar added a comment - Thank you marko for the quick analysis!
            danblack Daniel Black added a comment -

            DEBUG_SYNC_C in maria/myisam only failing for reason Marko said (include/mysql/plugin.h),
            however DEBUG_SYNC_C in include/mysql/service_debug_sync.h always passes THD as NULL.

            Best I've come up with so far is new debug_sync_service and debug_sync_C_callback_ptr without THD arg (propagates to quite a few changes), or rename maria/myisam files to C++.

            Tried NULL -> current_thread / _current_thread from ParadoxV5 that hasn't success yet.

            danblack Daniel Black added a comment - DEBUG_SYNC_C in maria/myisam only failing for reason Marko said (include/mysql/plugin.h), however DEBUG_SYNC_C in include/mysql/service_debug_sync.h always passes THD as NULL . Best I've come up with so far is new debug_sync_service and debug_sync_C_callback_ptr without THD arg (propagates to quite a few changes), or rename maria/myisam files to C++. Tried NULL -> current_thread / _current_thread from ParadoxV5 that hasn't success yet.
            danblack Daniel Black added a comment - ParadoxV5 can you review https://github.com/MariaDB/server/pull/3750 please.

            People

              danblack Daniel Black
              Roel Roel Van de Paar
              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.