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

UBSAN: function-type-mismatch in spider_param_conn_recycle[_mode/_strict], spider_param_internal_xa_snapshot, and spider_param_block_size

Details

    Description

      INSTALL SONAME 'ha_spider';
      CREATE TABLE t1 (c DATE) ENGINE=InnoDB;
      CREATE TABLE ts (c DATE) ENGINE=Spider COMMENT='DATABASE "test",table "t1"' CONNECTION='host "localhost",socket "../socket.sock",USER "Spider",PASSWORD ""';
      SELECT DISTINCT DATE_FORMAT(c,'%Y-%m-%d %H:%i:%s') FROM ts;
      

      Leads to:
      (Note: SIGSEGV stacks resolved by MDEV-35422 removed)

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/myisam/ha_myisam.cc:1340:11 
      /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'
      /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here
          #0 0x1457b0b94eaa in spider_param_conn_recycle_mode(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1
          #1 0x1457b0e68d6e in spider_get_conn(st_spider_share*, int, char*, st_spider_transaction*, ha_spider*, bool, bool, unsigned int, int*) /test/10.5_dbg_san/storage/spider/spd_conn.cc:678:12
          #2 0x1457b0fc163f in spider_get_share(char const*, TABLE*, THD*, ha_spider*, int*) /test/10.5_dbg_san/storage/spider/spd_table.cc:4614:13
          #3 0x1457b1139999 in ha_spider::open(char const*, int, unsigned int) /test/10.5_dbg_san/storage/spider/ha_spider.cc:310:18
          #4 0x5597668689b2 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
          #5 0x55976533cbaf 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
          #6 0x5597640ca635 in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:2024:12
          #7 0x5597640f7eb7 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
          #8 0x5597640ea759 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
          #9 0x55976411496a 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
          #10 0x559763e4fce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #11 0x559764764f0b in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6358:14
          #12 0x5597646fd59f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #13 0x5597646a44e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #14 0x559764684453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #15 0x5597646aca19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #16 0x559765626f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #17 0x5597656256fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #18 0x559763b20a8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #19 0x1457e309ca93 in start_thread nptl/pthread_create.c:447:8
          #20 0x1457e3129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/storage/spider/spd_param.cc:327:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'
      /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here
          #0 0x1457b0b94fea in spider_param_conn_recycle_strict(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:327:1
          #1 0x1457b0e68e72 in spider_get_conn(st_spider_share*, int, char*, st_spider_transaction*, ha_spider*, bool, bool, unsigned int, int*) /test/10.5_dbg_san/storage/spider/spd_conn.cc:679:11
          #2 0x1457b0fc163f in spider_get_share(char const*, TABLE*, THD*, ha_spider*, int*) /test/10.5_dbg_san/storage/spider/spd_table.cc:4614:13
          #3 0x1457b1139999 in ha_spider::open(char const*, int, unsigned int) /test/10.5_dbg_san/storage/spider/ha_spider.cc:310:18
          #4 0x5597668689b2 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
          #5 0x55976533cbaf 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
          #6 0x5597640ca635 in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:2024:12
          #7 0x5597640f7eb7 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
          #8 0x5597640ea759 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
          #9 0x55976411496a 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
          #10 0x559763e4fce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #11 0x559764764f0b in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6358:14
          #12 0x5597646fd59f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #13 0x5597646a44e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #14 0x559764684453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #15 0x5597646aca19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #16 0x559765626f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #17 0x5597656256fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #18 0x559763b20a8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #19 0x1457e309ca93 in start_thread nptl/pthread_create.c:447:8
          #20 0x1457e3129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:327:1 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/storage/spider/spd_param.cc:392:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'
      /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here
          #0 0x1457b0b954ea in spider_param_internal_xa_snapshot(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:392:1
          #1 0x1457b0c6d7cb in spider_internal_start_trx(ha_spider*) /test/10.5_dbg_san/storage/spider/spd_trx.cc:1610:35
          #2 0x1457b1171e20 in ha_spider::external_lock(THD*, int) /test/10.5_dbg_san/storage/spider/ha_spider.cc:969:9
          #3 0x55976686cbbe in handler::ha_external_lock(THD*, int) /test/10.5_dbg_san/sql/handler.cc:6833:3
          #4 0x55976744ec34 in lock_external(THD*, TABLE**, unsigned int) /test/10.5_dbg_san/sql/lock.cc:396:9
          #5 0x55976744b816 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /test/10.5_dbg_san/sql/lock.cc:341:32
          #6 0x559767443b8b in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /test/10.5_dbg_san/sql/lock.cc:304:7
          #7 0x55976410a67e in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /test/10.5_dbg_san/sql/sql_base.cc:5504:23
          #8 0x559764114f80 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
          #9 0x559763e4fce6 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:508:10
          #10 0x559764764f0b in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6358:14
          #11 0x5597646fd59f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #12 0x5597646a44e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #13 0x559764684453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #14 0x5597646aca19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #15 0x559765626f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #16 0x5597656256fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #17 0x559763b20a8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #18 0x1457e309ca93 in start_thread nptl/pthread_create.c:447:8
          #19 0x1457e3129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:392:1 
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/storage/spider/spd_param.cc:741:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'
      /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here
          #0 0x1457b0b976da in spider_param_block_size(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:741:1
          #1 0x1457b1259521 in ha_spider::info(unsigned int) /test/10.5_dbg_san/storage/spider/ha_spider.cc:5943:26
          #2 0x5597653e41bd in TABLE_LIST::fetch_number_of_rows() /test/10.5_dbg_san/sql/table.cc:9550:25
          #3 0x559764a1fd79 in make_join_statistics(JOIN*, List<TABLE_LIST>&, st_dynamic_array*) /test/10.5_dbg_san/sql/sql_select.cc:5147:20
          #4 0x559764a03095 in JOIN::optimize_inner() /test/10.5_dbg_san/sql/sql_select.cc:2416:7
          #5 0x5597649e002d in JOIN::optimize() /test/10.5_dbg_san/sql/sql_select.cc:1765:10
          #6 0x5597649909db 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:4904:19
          #7 0x55976498d0c7 in handle_select(THD*, LEX*, select_result*, unsigned long) /test/10.5_dbg_san/sql/sql_select.cc:449:10
          #8 0x5597647693f0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6437:12
          #9 0x5597646fd59f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #10 0x5597646a44e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #11 0x559764684453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #12 0x5597646aca19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #13 0x559765626f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #14 0x5597656256fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #15 0x559763b20a8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #16 0x1457e309ca93 in start_thread nptl/pthread_create.c:447:8
          #17 0x1457e3129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:741:1 
      

      (Note: UBSAN runtime error: member call on null pointer of type 'Item' in spider_db_print_item_type stack resolved by MDEV-35422 removed)

      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   # And you may also want to supress other UBSAN issues using 'suppressions=UBSAN.filter'. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter - just remember to remove the errors seen in this report.
      

      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

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            The SIGSEGV indeed is the same issue as MDEV-35422. However, the function-type-mismatch UBSAN failures are not. I am re-opening this for those, and assigning to bnestere as he knows how to fix these. As background info, they have become visible as a result of MDEV-34348 (and the patch for that bug already resolves a number of function-type-mismatch issues as I understand, though there are number that are still present, ref. the bugs associated with the 'function-type-mismatch' tag). Note that the only way to reproduce these is to use Clang builds. For all future UB+ASAN builds, it is likely best to use Clang instead of GCC.

            Roel Roel Van de Paar added a comment - - edited The SIGSEGV indeed is the same issue as MDEV-35422 . However, the function-type-mismatch UBSAN failures are not. I am re-opening this for those, and assigning to bnestere as he knows how to fix these. As background info, they have become visible as a result of MDEV-34348 (and the patch for that bug already resolves a number of function-type-mismatch issues as I understand, though there are number that are still present, ref. the bugs associated with the ' function-type-mismatch ' tag). Note that the only way to reproduce these is to use Clang builds. For all future UB+ASAN builds, it is likely best to use Clang instead of GCC.

            Reconfirmed the 'spider_param_conn_recycle_mode' function-type-mismatch on current 10.5 using the MTR testcase given here, and executed as:

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

            Leads to:

            CS 10.5.28 a226f12675c6312ca7632b90261397e313e6a7ae (Debug, UBASAN)

            /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'
            /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here
                #0 0x14ef1eb94eba in spider_param_conn_recycle_mode(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1
                #1 0x14ef1ec2be6e in spider_free_trx_conn(st_spider_transaction*, bool) /test/10.5_dbg_san/storage/spider/spd_trx.cc:110:19
                #2 0x14ef1ec89a25 in spider_rollback(handlerton*, THD*, bool) /test/10.5_dbg_san/storage/spider/spd_trx.cc:3242:5
                #3 0x14ef1f002d67 in spider_close_connection(handlerton*, THD*) /test/10.5_dbg_san/storage/spider/spd_table.cc:5934:3
                #4 0x55b9da1d7a3c in ha_close_connection(THD*) /test/10.5_dbg_san/sql/handler.cc:903:9
                #5 0x55b9d7be233f in THD::free_connection() /test/10.5_dbg_san/sql/sql_class.cc:1629:3
                #6 0x55b9d7517087 in unlink_thd(THD*) /test/10.5_dbg_san/sql/mysqld.cc:2640:8
                #7 0x55b9d8fcf418 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1397:5
                #8 0x55b9d8fcd88d in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
                #9 0x55b9d74c6a8c in asan_thread_start(void*) asan_interceptors.cpp.o
                #10 0x14ef35e9ca93 in start_thread nptl/pthread_create.c:447:8
                #11 0x14ef35f29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1
            

            Note there are currently many other UBSAN errors shown in the error log (Note: Clang build required, preferably v18+), including for example MDEV-35687 and MDEV-34512. These can be supressed or ignored using a supression filter, i.e. 'suppressions=UBSAN.filter' in UBSAN_OPTIONS. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter - just remember to remove the errors seen in this report so they remain visible.

            Roel Roel Van de Paar added a comment - Reconfirmed the 'spider_param_conn_recycle_mode' function-type-mismatch on current 10.5 using the MTR testcase given here , and executed as: export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1; . /mtr test Leads to: CS 10.5.28 a226f12675c6312ca7632b90261397e313e6a7ae (Debug, UBASAN) /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1: runtime error: call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)' /test/10.5_dbg_san/sql/sql_plugin.cc:3226: note: mysql_sys_var_int(THD*, int) defined here #0 0x14ef1eb94eba in spider_param_conn_recycle_mode(THD*) /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1 #1 0x14ef1ec2be6e in spider_free_trx_conn(st_spider_transaction*, bool) /test/10.5_dbg_san/storage/spider/spd_trx.cc:110:19 #2 0x14ef1ec89a25 in spider_rollback(handlerton*, THD*, bool) /test/10.5_dbg_san/storage/spider/spd_trx.cc:3242:5 #3 0x14ef1f002d67 in spider_close_connection(handlerton*, THD*) /test/10.5_dbg_san/storage/spider/spd_table.cc:5934:3 #4 0x55b9da1d7a3c in ha_close_connection(THD*) /test/10.5_dbg_san/sql/handler.cc:903:9 #5 0x55b9d7be233f in THD::free_connection() /test/10.5_dbg_san/sql/sql_class.cc:1629:3 #6 0x55b9d7517087 in unlink_thd(THD*) /test/10.5_dbg_san/sql/mysqld.cc:2640:8 #7 0x55b9d8fcf418 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1397:5 #8 0x55b9d8fcd88d in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5 #9 0x55b9d74c6a8c in asan_thread_start(void*) asan_interceptors.cpp.o #10 0x14ef35e9ca93 in start_thread nptl/pthread_create.c:447:8 #11 0x14ef35f29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/10.5_dbg_san/storage/spider/spd_param.cc:309:1 Note there are currently many other UBSAN errors shown in the error log (Note: Clang build required, preferably v18+), including for example MDEV-35687 and MDEV-34512 . These can be supressed or ignored using a supression filter, i.e. 'suppressions=UBSAN.filter' in UBSAN_OPTIONS . For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter - just remember to remove the errors seen in this report so they remain visible.
            Roel Roel Van de Paar added a comment - - edited

            bnestere Hi! So in summary, in this bug we are addressing the following 4 function-type-mismatch issues:

            UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_conn_recycle_mode|spider_get_conn|spider_get_share|ha_spider::open
            UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_conn_recycle_strict|spider_get_conn|spider_get_share|ha_spider::open
            UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_internal_xa_snapshot|spider_internal_start_trx|ha_spider::external_lock|handler::ha_external_lock
            UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_block_size|ha_spider::info|TABLE_LIST::fetch_number_of_rows|make_join_statistics
            

            • I have confirmed that MDEV-35422 fixes the SIGSEGV, as well as the final UBSAN error listed above (runtime error: member call on null pointer of type 'Item' in spider_db_print_item_type), so feel free to ignore those stacks.
            • Upon some reason, MTR (even with a modified testcase) only reproduces the spider_param_conn_recycle_mode function type mismatch, and not the spider_param_conn_recycle_strict, spider_param_internal_xa_snapshot, and spider_param_block_size function type mismatch stacks. Please use the CLI with the original testcase to reproduce those - if needed (i.e. perhaps you can see what to fix in the code simply by looking at the stacks above?). If you would like to reproduce the latter three, and it is not immediately clear how to do so, please let me know and I can assist! Thank you
            Roel Roel Van de Paar added a comment - - edited bnestere Hi! So in summary, in this bug we are addressing the following 4 function-type-mismatch issues: UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_conn_recycle_mode|spider_get_conn|spider_get_share|ha_spider::open UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_conn_recycle_strict|spider_get_conn|spider_get_share|ha_spider::open UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_internal_xa_snapshot|spider_internal_start_trx|ha_spider::external_lock|handler::ha_external_lock UBSAN|call to function mysql_sys_var_int(THD*, int) through pointer to incorrect function type 'unsigned int *(*)(THD *, int)'|storage/spider/spd_param.cc|spider_param_block_size|ha_spider::info|TABLE_LIST::fetch_number_of_rows|make_join_statistics I have confirmed that MDEV-35422 fixes the SIGSEGV, as well as the final UBSAN error listed above ( runtime error: member call on null pointer of type 'Item' in spider_db_print_item_type ), so feel free to ignore those stacks. Upon some reason, MTR (even with a modified testcase) only reproduces the spider_param_conn_recycle_mode function type mismatch, and not the spider_param_conn_recycle_strict , spider_param_internal_xa_snapshot , and spider_param_block_size function type mismatch stacks. Please use the CLI with the original testcase to reproduce those - if needed (i.e. perhaps you can see what to fix in the code simply by looking at the stacks above?). If you would like to reproduce the latter three, and it is not immediately clear how to do so, please let me know and I can assist! Thank you

            Furhter to the last point in the last comment, there is a testcase in MDEV-35698 which will reproduce the first 3 issues above, but not the 4th (i.e. spider_param_block_size) - besides reproducing the one listed in that ticket i.e. in spider_param_force_commit. It may be a better testcase to use (and include, if needed, in the test suite).

            Roel Roel Van de Paar added a comment - Furhter to the last point in the last comment, there is a testcase in MDEV-35698 which will reproduce the first 3 issues above, but not the 4th (i.e. spider_param_block_size ) - besides reproducing the one listed in that ticket i.e. in spider_param_force_commit . It may be a better testcase to use (and include, if needed, in the test suite).
            danblack Daniel Black added a comment -

            Fixed with MDEV-33158

            with MDEV-33158

            MariaDB [test]> CREATE TABLE ts (c DATE) ENGINE=Spider COMMENT='DATABASE "test",table "t1"' CONNECTION='host "localhost",socket "/tmp/build.sock",USER "Spider",PASSWORD ""';
            Query OK, 0 rows affected (0.001 sec)
             
            MariaDB [test]> SELECT DISTINCT DATE_FORMAT(c,'%Y-%m-%d %H:%i:%s') FROM ts;
            ERROR 12720 (HY000): Host:localhost and Socket:/tmp/build.sock aim self server. Please change spider_same_server_link parameter if this link is required.
            

            danblack Daniel Black added a comment - Fixed with MDEV-33158 with MDEV-33158 MariaDB [test]> CREATE TABLE ts (c DATE) ENGINE=Spider COMMENT='DATABASE "test",table "t1"' CONNECTION='host "localhost",socket "/tmp/build.sock",USER "Spider",PASSWORD ""'; Query OK, 0 rows affected (0.001 sec)   MariaDB [test]> SELECT DISTINCT DATE_FORMAT(c,'%Y-%m-%d %H:%i:%s') FROM ts; ERROR 12720 (HY000): Host:localhost and Socket:/tmp/build.sock aim self server. Please change spider_same_server_link parameter if this link is required.

            People

              bnestere Brandon Nesterenko
              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.