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

runtime error: call to function spider_direct_sql, spider_flush_table_mon_cache, spider_copy_tables through pointer to incorrect function type in udf_handler::val_in

Details

    Description

      Additional function-type-mismatch.

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      SELECT spider_direct_sql ('SELECT 1','','SRV "a"');
      

      Leads to:

      CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang)

      /test/11.8_opt_san/sql/sql_udf.h:104:18: runtime error: call to function spider_direct_sql through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
      /test/11.8_opt_san/storage/spider/spd_udf.cc:27: note: spider_direct_sql defined here
          #0 0x5573db856551 in udf_handler::val_int(char*) /test/11.8_opt_san/sql/sql_udf.h:104:18
          #1 0x5573db856551 in Item_func_udf_int::val_int() /test/11.8_opt_san/sql/item_func.cc:3860:12
          #2 0x5573daff2a71 in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_opt_san/sql/sql_type.cc:7706:22
          #3 0x5573d9ee6e04 in Protocol::send_result_set_row(List<Item>*) /test/11.8_opt_san/sql/protocol.cc:1353:15
          #4 0x5573da1b06a3 in select_send::send_data(List<Item>&) /test/11.8_opt_san/sql/sql_class.cc:3275:17
          #5 0x5573da65b648 in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:4908:22
          #6 0x5573da656e21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8
          #7 0x5573da5b3a2b 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
          #8 0x5573da5b1c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10
          #9 0x5573da465dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12
          #10 0x5573da44afc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12
          #11 0x5573da413c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18
          #12 0x5573da408b9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7
          #13 0x5573da416a6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17
          #14 0x5573dabf7e38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11
          #15 0x5573dabf7280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5
          #16 0x5573d9d3fb0c in asan_thread_start(void*) asan_interceptors.cpp.o
          #17 0x152d0ea9ca93 in start_thread nptl/pthread_create.c:447:8
          #18 0x152d0eb29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:104:18 
      

      CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang)

      /test/11.8_dbg_san/sql/sql_udf.h:104:18: runtime error: call to function spider_direct_sql through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
      /test/11.8_dbg_san/storage/spider/spd_udf.cc:27: note: spider_direct_sql defined here
          #0 0x560ac2ab62dd in udf_handler::val_int(char*) /test/11.8_dbg_san/sql/sql_udf.h:104:18
          #1 0x560ac2ab5ead in Item_func_udf_int::val_int() /test/11.8_dbg_san/sql/item_func.cc:3860:12
          #2 0x560ac188947b in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.cc:7706:22
          #3 0x560ac18d641c in Type_handler_longlong::Item_send(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.h:6085:12
          #4 0x560abf18b617 in Item::send(Protocol*, st_value*) /test/11.8_dbg_san/sql/item.h:1256:28
          #5 0x560abf435681 in Protocol::send_result_set_row(List<Item>*) /test/11.8_dbg_san/sql/protocol.cc:1353:15
          #6 0x560abfa7204a in select_send::send_data(List<Item>&) /test/11.8_dbg_san/sql/sql_class.cc:3275:17
          #7 0x560ac0473fd0 in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /test/11.8_dbg_san/sql/sql_class.h:6244:12
          #8 0x560ac046e163 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:4908:22
          #9 0x560ac046a56a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8
          #10 0x560ac0308a79 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
          #11 0x560ac0304137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10
          #12 0x560abffefee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12
          #13 0x560abff8fdcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12
          #14 0x560abff35ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18
          #15 0x560abff16db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7
          #16 0x560abff3fe56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17
          #17 0x560ac10a2556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11
          #18 0x560ac10a0d19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5
          #19 0x560abf0e95fc in asan_thread_start(void*) asan_interceptors.cpp.o
          #20 0x14621e89ca93 in start_thread nptl/pthread_create.c:447:8
          #21 0x14621e929c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:104:18 
      

      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 UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1   # And you may also want to supress UBSAN startup 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
      

      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

            An additional very similar issue. It looks like more Spider functions may be affected:

            INSTALL PLUGIN spider SONAME 'ha_spider.so';
            SELECT spider_flush_table_mon_cache();
            

            Leads to:

            CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang)

            /test/11.8_opt_san/sql/sql_udf.h:104:18: runtime error: call to function spider_flush_table_mon_cache through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
            /test/11.8_opt_san/storage/spider/spd_udf.cc:113: note: spider_flush_table_mon_cache defined here
                #0 0x55a824a54551 in udf_handler::val_int(char*) /test/11.8_opt_san/sql/sql_udf.h:104:18
                #1 0x55a824a54551 in Item_func_udf_int::val_int() /test/11.8_opt_san/sql/item_func.cc:3860:12
                #2 0x55a8241f0a71 in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_opt_san/sql/sql_type.cc:7706:22
                #3 0x55a8230e4e04 in Protocol::send_result_set_row(List<Item>*) /test/11.8_opt_san/sql/protocol.cc:1353:15
                #4 0x55a8233ae6a3 in select_send::send_data(List<Item>&) /test/11.8_opt_san/sql/sql_class.cc:3275:17
                #5 0x55a823859648 in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:4908:22
                #6 0x55a823854e21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8
                #7 0x55a8237b1a2b 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
                #8 0x55a8237afc4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10
                #9 0x55a823663dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12
                #10 0x55a823648fc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12
                #11 0x55a823611c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18
                #12 0x55a823606b9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7
                #13 0x55a823614a6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17
                #14 0x55a823df5e38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11
                #15 0x55a823df5280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5
                #16 0x55a822f3db0c in asan_thread_start(void*) asan_interceptors.cpp.o
                #17 0x1458f3c9ca93 in start_thread nptl/pthread_create.c:447:8
                #18 0x1458f3d29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:104:18 
            

            CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang)

            /test/11.8_dbg_san/sql/sql_udf.h:104:18: runtime error: call to function spider_flush_table_mon_cache through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
            /test/11.8_dbg_san/storage/spider/spd_udf.cc:113: note: spider_flush_table_mon_cache defined here
                #0 0x555e082842dd in udf_handler::val_int(char*) /test/11.8_dbg_san/sql/sql_udf.h:104:18
                #1 0x555e08283ead in Item_func_udf_int::val_int() /test/11.8_dbg_san/sql/item_func.cc:3860:12
                #2 0x555e0705747b in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.cc:7706:22
                #3 0x555e070a441c in Type_handler_longlong::Item_send(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.h:6085:12
                #4 0x555e04959617 in Item::send(Protocol*, st_value*) /test/11.8_dbg_san/sql/item.h:1256:28
                #5 0x555e04c03681 in Protocol::send_result_set_row(List<Item>*) /test/11.8_dbg_san/sql/protocol.cc:1353:15
                #6 0x555e0524004a in select_send::send_data(List<Item>&) /test/11.8_dbg_san/sql/sql_class.cc:3275:17
                #7 0x555e05c41fd0 in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /test/11.8_dbg_san/sql/sql_class.h:6244:12
                #8 0x555e05c3c163 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:4908:22
                #9 0x555e05c3856a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8
                #10 0x555e05ad6a79 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
                #11 0x555e05ad2137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10
                #12 0x555e057bdee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12
                #13 0x555e0575ddcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12
                #14 0x555e05703ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18
                #15 0x555e056e4db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7
                #16 0x555e0570de56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17
                #17 0x555e06870556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11
                #18 0x555e0686ed19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5
                #19 0x555e048b75fc in asan_thread_start(void*) asan_interceptors.cpp.o
                #20 0x146f7409ca93 in start_thread nptl/pthread_create.c:447:8
                #21 0x146f74129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:104:18 
            

            Roel Roel Van de Paar added a comment - - edited An additional very similar issue. It looks like more Spider functions may be affected: INSTALL PLUGIN spider SONAME 'ha_spider.so' ; SELECT spider_flush_table_mon_cache(); Leads to: CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang) /test/11.8_opt_san/sql/sql_udf.h:104:18: runtime error: call to function spider_flush_table_mon_cache through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)' /test/11.8_opt_san/storage/spider/spd_udf.cc:113: note: spider_flush_table_mon_cache defined here #0 0x55a824a54551 in udf_handler::val_int(char*) /test/11.8_opt_san/sql/sql_udf.h:104:18 #1 0x55a824a54551 in Item_func_udf_int::val_int() /test/11.8_opt_san/sql/item_func.cc:3860:12 #2 0x55a8241f0a71 in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_opt_san/sql/sql_type.cc:7706:22 #3 0x55a8230e4e04 in Protocol::send_result_set_row(List<Item>*) /test/11.8_opt_san/sql/protocol.cc:1353:15 #4 0x55a8233ae6a3 in select_send::send_data(List<Item>&) /test/11.8_opt_san/sql/sql_class.cc:3275:17 #5 0x55a823859648 in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:4908:22 #6 0x55a823854e21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8 #7 0x55a8237b1a2b 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 #8 0x55a8237afc4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10 #9 0x55a823663dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12 #10 0x55a823648fc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12 #11 0x55a823611c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18 #12 0x55a823606b9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7 #13 0x55a823614a6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17 #14 0x55a823df5e38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11 #15 0x55a823df5280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5 #16 0x55a822f3db0c in asan_thread_start(void*) asan_interceptors.cpp.o #17 0x1458f3c9ca93 in start_thread nptl/pthread_create.c:447:8 #18 0x1458f3d29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:104:18 CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang) /test/11.8_dbg_san/sql/sql_udf.h:104:18: runtime error: call to function spider_flush_table_mon_cache through pointer to incorrect function type 'long long (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)' /test/11.8_dbg_san/storage/spider/spd_udf.cc:113: note: spider_flush_table_mon_cache defined here #0 0x555e082842dd in udf_handler::val_int(char*) /test/11.8_dbg_san/sql/sql_udf.h:104:18 #1 0x555e08283ead in Item_func_udf_int::val_int() /test/11.8_dbg_san/sql/item_func.cc:3860:12 #2 0x555e0705747b in Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.cc:7706:22 #3 0x555e070a441c in Type_handler_longlong::Item_send(Item*, Protocol*, st_value*) const /test/11.8_dbg_san/sql/sql_type.h:6085:12 #4 0x555e04959617 in Item::send(Protocol*, st_value*) /test/11.8_dbg_san/sql/item.h:1256:28 #5 0x555e04c03681 in Protocol::send_result_set_row(List<Item>*) /test/11.8_dbg_san/sql/protocol.cc:1353:15 #6 0x555e0524004a in select_send::send_data(List<Item>&) /test/11.8_dbg_san/sql/sql_class.cc:3275:17 #7 0x555e05c41fd0 in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /test/11.8_dbg_san/sql/sql_class.h:6244:12 #8 0x555e05c3c163 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:4908:22 #9 0x555e05c3856a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8 #10 0x555e05ad6a79 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 #11 0x555e05ad2137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10 #12 0x555e057bdee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12 #13 0x555e0575ddcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12 #14 0x555e05703ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18 #15 0x555e056e4db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7 #16 0x555e0570de56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17 #17 0x555e06870556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11 #18 0x555e0686ed19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5 #19 0x555e048b75fc in asan_thread_start(void*) asan_interceptors.cpp.o #20 0x146f7409ca93 in start_thread nptl/pthread_create.c:447:8 #21 0x146f74129c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:104:18

            Four additional stacks observed with:

            INSTALL SONAME 'ha_spider';
            SELECT spider_bg_direct_sql ('SET SESSION _offset=2','','SRV "s"');
            

            Leads to:

            CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang)

            /test/11.8_dbg_san/sql/sql_udf.h:118:5: runtime error: call to function spider_bg_direct_sql_clear through pointer to incorrect function type 'void (*)(st_udf_init *, unsigned char *, unsigned char *)'
            /test/11.8_dbg_san/storage/spider/spd_udf.cc:72: note: spider_bg_direct_sql_clear defined here
                #0 0x557f5d052678 in udf_handler::clear() /test/11.8_dbg_san/sql/sql_udf.h:118:5
                #1 0x557f5d052479 in Item_udf_sum::clear() /test/11.8_dbg_san/sql/item_sum.cc:3378:7
                #2 0x557f5d089bba in Aggregator_simple::clear() /test/11.8_dbg_san/sql/item_sum.h:733:37
                #3 0x557f5945043a in Item_sum::aggregator_clear() /test/11.8_dbg_san/sql/item_sum.h:561:42
                #4 0x557f593cddec in Item_sum::reset_and_add() /test/11.8_dbg_san/sql/item_sum.h:447:5
                #5 0x557f5a6a5b50 in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_dbg_san/sql/sql_select.cc:29713:22
                #6 0x557f5a6858c7 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_dbg_san/sql/sql_select.cc:25667:11
                #7 0x557f5a5048f4 in do_select(JOIN*, Procedure*) /test/11.8_dbg_san/sql/sql_select.cc:23536:14
                #8 0x557f5a4fce79 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:5037:50
                #9 0x557f5a4f556a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8
                #10 0x557f5a393a79 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
                #11 0x557f5a38f137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10
                #12 0x557f5a07aee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12
                #13 0x557f5a01adcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12
                #14 0x557f59fc0ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18
                #15 0x557f59fa1db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7
                #16 0x557f59fcae56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17
                #17 0x557f5b12d556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11
                #18 0x557f5b12bd19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5
                #19 0x557f591745fc in asan_thread_start(void*) asan_interceptors.cpp.o
                #20 0x14596229ca93 in start_thread nptl/pthread_create.c:447:8
                #21 0x145962329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:118:5 
            /test/11.8_dbg_san/sql/sql_udf.h:128:5: runtime error: call to function spider_bg_direct_sql_add through pointer to incorrect function type 'void (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
            /test/11.8_dbg_san/storage/spider/spd_udf.cc:81: note: spider_bg_direct_sql_add defined here
                #0 0x557f5d052caf in udf_handler::add(char*) /test/11.8_dbg_san/sql/sql_udf.h:128:5
                #1 0x557f5d0528dc in Item_udf_sum::add() /test/11.8_dbg_san/sql/item_sum.cc:3386:7
                #2 0x557f5d089e8a in Aggregator_simple::add() /test/11.8_dbg_san/sql/item_sum.h:734:42
                #3 0x557f5945070a in Item_sum::aggregator_add() /test/11.8_dbg_san/sql/item_sum.h:567:47
                #4 0x557f593cdea2 in Item_sum::reset_and_add() /test/11.8_dbg_san/sql/item_sum.h:448:12
                #5 0x557f5a6a5b50 in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_dbg_san/sql/sql_select.cc:29713:22
                #6 0x557f5a6858c7 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_dbg_san/sql/sql_select.cc:25667:11
                #7 0x557f5a5048f4 in do_select(JOIN*, Procedure*) /test/11.8_dbg_san/sql/sql_select.cc:23536:14
                #8 0x557f5a4fce79 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:5037:50
                #9 0x557f5a4f556a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8
                #10 0x557f5a393a79 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
                #11 0x557f5a38f137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10
                #12 0x557f5a07aee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12
                #13 0x557f5a01adcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12
                #14 0x557f59fc0ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18
                #15 0x557f59fa1db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7
                #16 0x557f59fcae56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17
                #17 0x557f5b12d556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11
                #18 0x557f5b12bd19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5
                #19 0x557f591745fc in asan_thread_start(void*) asan_interceptors.cpp.o
                #20 0x14596229ca93 in start_thread nptl/pthread_create.c:447:8
                #21 0x145962329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:128:5 
            

            CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang)

            /test/11.8_opt_san/sql/sql_udf.h:118:5: runtime error: call to function spider_bg_direct_sql_clear through pointer to incorrect function type 'void (*)(st_udf_init *, unsigned char *, unsigned char *)'
            /test/11.8_opt_san/storage/spider/spd_udf.cc:72: note: spider_bg_direct_sql_clear defined here
                #0 0x55e182f50271 in udf_handler::clear() /test/11.8_opt_san/sql/sql_udf.h:118:5
                #1 0x55e182f50271 in Item_udf_sum::clear() /test/11.8_opt_san/sql/item_sum.cc:3378:7
                #2 0x55e181296201 in Item_sum::aggregator_clear() /test/11.8_opt_san/sql/item_sum.h:561:42
                #3 0x55e181296201 in Item_sum::reset_and_add() /test/11.8_opt_san/sql/item_sum.h:447:5
                #4 0x55e181b3fc1a in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_opt_san/sql/sql_select.cc:29713:22
                #5 0x55e181b2d7a1 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_opt_san/sql/sql_select.cc:25667:11
                #6 0x55e181a72fdd in do_select(JOIN*, Procedure*) /test/11.8_opt_san/sql/sql_select.cc:23536:14
                #7 0x55e181a6d12c in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:5037:50
                #8 0x55e181a6ae21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8
                #9 0x55e1819c7a2b 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
                #10 0x55e1819c5c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10
                #11 0x55e181879dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12
                #12 0x55e18185efc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12
                #13 0x55e181827c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18
                #14 0x55e18181cb9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7
                #15 0x55e18182aa6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17
                #16 0x55e18200be38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11
                #17 0x55e18200b280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5
                #18 0x55e181153b0c in asan_thread_start(void*) asan_interceptors.cpp.o
                #19 0x14d23a29ca93 in start_thread nptl/pthread_create.c:447:8
                #20 0x14d23a329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:118:5 
            /test/11.8_opt_san/sql/sql_udf.h:128:5: runtime error: call to function spider_bg_direct_sql_add through pointer to incorrect function type 'void (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)'
            /test/11.8_opt_san/storage/spider/spd_udf.cc:81: note: spider_bg_direct_sql_add defined here
                #0 0x55e182f50568 in udf_handler::add(char*) /test/11.8_opt_san/sql/sql_udf.h:128:5
                #1 0x55e182f50568 in Item_udf_sum::add() /test/11.8_opt_san/sql/item_sum.cc:3386:7
                #2 0x55e181b3fc1a in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_opt_san/sql/sql_select.cc:29713:22
                #3 0x55e181b2d7a1 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_opt_san/sql/sql_select.cc:25667:11
                #4 0x55e181a72fdd in do_select(JOIN*, Procedure*) /test/11.8_opt_san/sql/sql_select.cc:23536:14
                #5 0x55e181a6d12c in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:5037:50
                #6 0x55e181a6ae21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8
                #7 0x55e1819c7a2b 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
                #8 0x55e1819c5c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10
                #9 0x55e181879dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12
                #10 0x55e18185efc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12
                #11 0x55e181827c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18
                #12 0x55e18181cb9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7
                #13 0x55e18182aa6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17
                #14 0x55e18200be38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11
                #15 0x55e18200b280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5
                #16 0x55e181153b0c in asan_thread_start(void*) asan_interceptors.cpp.o
                #17 0x14d23a29ca93 in start_thread nptl/pthread_create.c:447:8
                #18 0x14d23a329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
             
            SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:128:5 
            

            Roel Roel Van de Paar added a comment - Four additional stacks observed with: INSTALL SONAME 'ha_spider' ; SELECT spider_bg_direct_sql ( 'SET SESSION _offset=2' , '' , 'SRV "s"' ); Leads to: CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Debug, UBASAN, Clang) /test/11.8_dbg_san/sql/sql_udf.h:118:5: runtime error: call to function spider_bg_direct_sql_clear through pointer to incorrect function type 'void (*)(st_udf_init *, unsigned char *, unsigned char *)' /test/11.8_dbg_san/storage/spider/spd_udf.cc:72: note: spider_bg_direct_sql_clear defined here #0 0x557f5d052678 in udf_handler::clear() /test/11.8_dbg_san/sql/sql_udf.h:118:5 #1 0x557f5d052479 in Item_udf_sum::clear() /test/11.8_dbg_san/sql/item_sum.cc:3378:7 #2 0x557f5d089bba in Aggregator_simple::clear() /test/11.8_dbg_san/sql/item_sum.h:733:37 #3 0x557f5945043a in Item_sum::aggregator_clear() /test/11.8_dbg_san/sql/item_sum.h:561:42 #4 0x557f593cddec in Item_sum::reset_and_add() /test/11.8_dbg_san/sql/item_sum.h:447:5 #5 0x557f5a6a5b50 in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_dbg_san/sql/sql_select.cc:29713:22 #6 0x557f5a6858c7 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_dbg_san/sql/sql_select.cc:25667:11 #7 0x557f5a5048f4 in do_select(JOIN*, Procedure*) /test/11.8_dbg_san/sql/sql_select.cc:23536:14 #8 0x557f5a4fce79 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:5037:50 #9 0x557f5a4f556a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8 #10 0x557f5a393a79 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 #11 0x557f5a38f137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10 #12 0x557f5a07aee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12 #13 0x557f5a01adcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12 #14 0x557f59fc0ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18 #15 0x557f59fa1db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7 #16 0x557f59fcae56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17 #17 0x557f5b12d556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11 #18 0x557f5b12bd19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5 #19 0x557f591745fc in asan_thread_start(void*) asan_interceptors.cpp.o #20 0x14596229ca93 in start_thread nptl/pthread_create.c:447:8 #21 0x145962329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:118:5 /test/11.8_dbg_san/sql/sql_udf.h:128:5: runtime error: call to function spider_bg_direct_sql_add through pointer to incorrect function type 'void (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)' /test/11.8_dbg_san/storage/spider/spd_udf.cc:81: note: spider_bg_direct_sql_add defined here #0 0x557f5d052caf in udf_handler::add(char*) /test/11.8_dbg_san/sql/sql_udf.h:128:5 #1 0x557f5d0528dc in Item_udf_sum::add() /test/11.8_dbg_san/sql/item_sum.cc:3386:7 #2 0x557f5d089e8a in Aggregator_simple::add() /test/11.8_dbg_san/sql/item_sum.h:734:42 #3 0x557f5945070a in Item_sum::aggregator_add() /test/11.8_dbg_san/sql/item_sum.h:567:47 #4 0x557f593cdea2 in Item_sum::reset_and_add() /test/11.8_dbg_san/sql/item_sum.h:448:12 #5 0x557f5a6a5b50 in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_dbg_san/sql/sql_select.cc:29713:22 #6 0x557f5a6858c7 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_dbg_san/sql/sql_select.cc:25667:11 #7 0x557f5a5048f4 in do_select(JOIN*, Procedure*) /test/11.8_dbg_san/sql/sql_select.cc:23536:14 #8 0x557f5a4fce79 in JOIN::exec_inner() /test/11.8_dbg_san/sql/sql_select.cc:5037:50 #9 0x557f5a4f556a in JOIN::exec() /test/11.8_dbg_san/sql/sql_select.cc:4820:8 #10 0x557f5a393a79 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 #11 0x557f5a38f137 in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_dbg_san/sql/sql_select.cc:633:10 #12 0x557f5a07aee0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_dbg_san/sql/sql_parse.cc:6177:12 #13 0x557f5a01adcc in mysql_execute_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:3966:12 #14 0x557f59fc0ef9 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_dbg_san/sql/sql_parse.cc:7901:18 #15 0x557f59fa1db8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1903:7 #16 0x557f59fcae56 in do_command(THD*, bool) /test/11.8_dbg_san/sql/sql_parse.cc:1416:17 #17 0x557f5b12d556 in do_handle_one_connection(CONNECT*, bool) /test/11.8_dbg_san/sql/sql_connect.cc:1415:11 #18 0x557f5b12bd19 in handle_one_connection /test/11.8_dbg_san/sql/sql_connect.cc:1327:5 #19 0x557f591745fc in asan_thread_start(void*) asan_interceptors.cpp.o #20 0x14596229ca93 in start_thread nptl/pthread_create.c:447:8 #21 0x145962329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_dbg_san/sql/sql_udf.h:128:5 CS 11.8.0 7734c85c31c9e292ef1133115fba2f7edd71dd51 (Optimized, UBASAN, Clang) /test/11.8_opt_san/sql/sql_udf.h:118:5: runtime error: call to function spider_bg_direct_sql_clear through pointer to incorrect function type 'void (*)(st_udf_init *, unsigned char *, unsigned char *)' /test/11.8_opt_san/storage/spider/spd_udf.cc:72: note: spider_bg_direct_sql_clear defined here #0 0x55e182f50271 in udf_handler::clear() /test/11.8_opt_san/sql/sql_udf.h:118:5 #1 0x55e182f50271 in Item_udf_sum::clear() /test/11.8_opt_san/sql/item_sum.cc:3378:7 #2 0x55e181296201 in Item_sum::aggregator_clear() /test/11.8_opt_san/sql/item_sum.h:561:42 #3 0x55e181296201 in Item_sum::reset_and_add() /test/11.8_opt_san/sql/item_sum.h:447:5 #4 0x55e181b3fc1a in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_opt_san/sql/sql_select.cc:29713:22 #5 0x55e181b2d7a1 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_opt_san/sql/sql_select.cc:25667:11 #6 0x55e181a72fdd in do_select(JOIN*, Procedure*) /test/11.8_opt_san/sql/sql_select.cc:23536:14 #7 0x55e181a6d12c in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:5037:50 #8 0x55e181a6ae21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8 #9 0x55e1819c7a2b 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 #10 0x55e1819c5c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10 #11 0x55e181879dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12 #12 0x55e18185efc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12 #13 0x55e181827c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18 #14 0x55e18181cb9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7 #15 0x55e18182aa6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17 #16 0x55e18200be38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11 #17 0x55e18200b280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5 #18 0x55e181153b0c in asan_thread_start(void*) asan_interceptors.cpp.o #19 0x14d23a29ca93 in start_thread nptl/pthread_create.c:447:8 #20 0x14d23a329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:118:5 /test/11.8_opt_san/sql/sql_udf.h:128:5: runtime error: call to function spider_bg_direct_sql_add through pointer to incorrect function type 'void (*)(st_udf_init *, st_udf_args *, unsigned char *, unsigned char *)' /test/11.8_opt_san/storage/spider/spd_udf.cc:81: note: spider_bg_direct_sql_add defined here #0 0x55e182f50568 in udf_handler::add(char*) /test/11.8_opt_san/sql/sql_udf.h:128:5 #1 0x55e182f50568 in Item_udf_sum::add() /test/11.8_opt_san/sql/item_sum.cc:3386:7 #2 0x55e181b3fc1a in init_sum_functions(Item_sum**, Item_sum**) /test/11.8_opt_san/sql/sql_select.cc:29713:22 #3 0x55e181b2d7a1 in end_send_group(JOIN*, st_join_table*, bool) /test/11.8_opt_san/sql/sql_select.cc:25667:11 #4 0x55e181a72fdd in do_select(JOIN*, Procedure*) /test/11.8_opt_san/sql/sql_select.cc:23536:14 #5 0x55e181a6d12c in JOIN::exec_inner() /test/11.8_opt_san/sql/sql_select.cc:5037:50 #6 0x55e181a6ae21 in JOIN::exec() /test/11.8_opt_san/sql/sql_select.cc:4820:8 #7 0x55e1819c7a2b 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 #8 0x55e1819c5c4d in handle_select(THD*, LEX*, select_result*, unsigned long long) /test/11.8_opt_san/sql/sql_select.cc:633:10 #9 0x55e181879dac in execute_sqlcom_select(THD*, TABLE_LIST*) /test/11.8_opt_san/sql/sql_parse.cc:6177:12 #10 0x55e18185efc7 in mysql_execute_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:3966:12 #11 0x55e181827c92 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.8_opt_san/sql/sql_parse.cc:7901:18 #12 0x55e18181cb9e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.8_opt_san/sql/sql_parse.cc:1903:7 #13 0x55e18182aa6e in do_command(THD*, bool) /test/11.8_opt_san/sql/sql_parse.cc:1416:17 #14 0x55e18200be38 in do_handle_one_connection(CONNECT*, bool) /test/11.8_opt_san/sql/sql_connect.cc:1415:11 #15 0x55e18200b280 in handle_one_connection /test/11.8_opt_san/sql/sql_connect.cc:1327:5 #16 0x55e181153b0c in asan_thread_start(void*) asan_interceptors.cpp.o #17 0x14d23a29ca93 in start_thread nptl/pthread_create.c:447:8 #18 0x14d23a329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78   SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.8_opt_san/sql/sql_udf.h:128:5
            danblack Daniel Black added a comment -

            pushed commit to tail of https://github.com/MariaDB/server/pull/3737.

            performed manual testing in UBSAN environment as its not completely runable in mtr:

            MariaDB [(none)]> CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET '/tmp/build.sock',DATABASE 'test',user 'buildbot',PASSWORD '');
            Query OK, 0 rows affected (0.001 sec)
             
             
            MariaDB [(none)]> set spider_same_server_link=1;
            Query OK, 0 rows affected (0.000 sec)
             
            MariaDB [(none)]> use test;
            Database changed
            MariaDB [test]> CREATE TABLE dst (c INT, d DATE, PRIMARY KEY(c)) ENGINE=INNODB;
            Query OK, 0 rows affected (0.002 sec)
             
            MariaDB [test]> INSERT INTO dst VALUES (555, '1999-12-12');
            Query OK, 1 row affected (0.001 sec)
             
            MariaDB [test]> CREATE TABLE src (c INT, d DATE, PRIMARY KEY(c));
            Query OK, 0 rows affected (0.002 sec)
             
            MariaDB [test]> INSERT INTO src VALUES (42, '2024-08-27'), (73, '2024-07-12');
            Query OK, 2 rows affected (0.001 sec)
            Records: 2  Duplicates: 0  Warnings: 0
             
            MariaDB [test]>  CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER
                -> COMMENT='table "src dst", srv "srv srv"';
            Query OK, 0 rows affected (0.002 sec)
             
            MariaDB [test]> SELECT spider_copy_tables('t', '0', '1');
            +-----------------------------------+
            | spider_copy_tables('t', '0', '1') |
            +-----------------------------------+
            |                                 1 |
            +-----------------------------------+
            1 row in set (0.004 sec)
             
            MariaDB [test]> SELECT spider_flush_table_mon_cache();
            +--------------------------------+
            | spider_flush_table_mon_cache() |
            +--------------------------------+
            |                              1 |
            +--------------------------------+
            1 row in set (0.001 sec)
             
            MariaDB [test]> SELECT spider_bg_direct_sql ('SET @offset=2','','SRV "srv"');
            +-------------------------------------------------------+
            | spider_bg_direct_sql ('SET @offset=2','','SRV "srv"') |
            +-------------------------------------------------------+
            |                                                     1 |
            +-------------------------------------------------------+
            1 row in set (0.003 sec)
             
            MariaDB [test]> SELECT spider_direct_sql ('SET @offset=2','','SRV "srv"');
            +----------------------------------------------------+
            | spider_direct_sql ('SET @offset=2','','SRV "srv"') |
            +----------------------------------------------------+
            |                                                  1 |
            +----------------------------------------------------+
            1 row in set (0.001 sec)
            
            

            danblack Daniel Black added a comment - pushed commit to tail of https://github.com/MariaDB/server/pull/3737 . performed manual testing in UBSAN environment as its not completely runable in mtr: MariaDB [(none)]> CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET '/tmp/build.sock',DATABASE 'test',user 'buildbot',PASSWORD ''); Query OK, 0 rows affected (0.001 sec)     MariaDB [(none)]> set spider_same_server_link=1; Query OK, 0 rows affected (0.000 sec)   MariaDB [(none)]> use test; Database changed MariaDB [test]> CREATE TABLE dst (c INT, d DATE, PRIMARY KEY(c)) ENGINE=INNODB; Query OK, 0 rows affected (0.002 sec)   MariaDB [test]> INSERT INTO dst VALUES (555, '1999-12-12'); Query OK, 1 row affected (0.001 sec)   MariaDB [test]> CREATE TABLE src (c INT, d DATE, PRIMARY KEY(c)); Query OK, 0 rows affected (0.002 sec)   MariaDB [test]> INSERT INTO src VALUES (42, '2024-08-27'), (73, '2024-07-12'); Query OK, 2 rows affected (0.001 sec) Records: 2 Duplicates: 0 Warnings: 0   MariaDB [test]> CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER -> COMMENT='table "src dst", srv "srv srv"'; Query OK, 0 rows affected (0.002 sec)   MariaDB [test]> SELECT spider_copy_tables('t', '0', '1'); +-----------------------------------+ | spider_copy_tables('t', '0', '1') | +-----------------------------------+ | 1 | +-----------------------------------+ 1 row in set (0.004 sec)   MariaDB [test]> SELECT spider_flush_table_mon_cache(); +--------------------------------+ | spider_flush_table_mon_cache() | +--------------------------------+ | 1 | +--------------------------------+ 1 row in set (0.001 sec)   MariaDB [test]> SELECT spider_bg_direct_sql ('SET @offset=2','','SRV "srv"'); +-------------------------------------------------------+ | spider_bg_direct_sql ('SET @offset=2','','SRV "srv"') | +-------------------------------------------------------+ | 1 | +-------------------------------------------------------+ 1 row in set (0.003 sec)   MariaDB [test]> SELECT spider_direct_sql ('SET @offset=2','','SRV "srv"'); +----------------------------------------------------+ | spider_direct_sql ('SET @offset=2','','SRV "srv"') | +----------------------------------------------------+ | 1 | +----------------------------------------------------+ 1 row in set (0.001 sec)

            People

              danblack Daniel Black
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.