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

UBSAN|load of value X, which is not a valid value for type 'bool'|storage/connect/ha_connect.cc

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      INSTALL SONAME 'ha_connect';
      CREATE TABLE t1 (c2 VECTOR(1) NOT NULL,VECTOR INDEX(c2)) ENGINE=CONNECT;
      

      Leads to:

      CS 13.0.2 1a4bb1bbfde5fa17ba148cb62678902f11c66a1a (Debug, UBASAN, Clang 22.1.8-20260621) Build 12/08/2026

      2026-08-13 11:21:37 4 [Note] CONNECT: Version 1.07.0002 March 22, 2021
      /test/13.0_dbg_san/storage/connect/ha_connect.cc:1719:23: runtime error: load of value 6, which is not a valid value for type 'bool'
          #0 0x6fea75c0a085 in ha_connect::GetIndexOption(st_key*, char const*) /test/13.0_dbg_san/storage/connect/ha_connect.cc
          #1 0x6fea75c0fba7 in ha_connect::GetIndexInfo(TABLE_SHARE*) /test/13.0_dbg_san/storage/connect/ha_connect.cc:1808:19
          #2 0x6fea75c2fd68 in ha_connect::create(char const*, TABLE*, HA_CREATE_INFO*) /test/13.0_dbg_san/storage/connect/ha_connect.cc:6921:15
          #3 0x643d181f7540 in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /test/13.0_dbg_san/sql/handler.cc:6241:14
          #4 0x643d181fe742 in ha_create_table_from_share(THD*, TABLE_SHARE*, HA_CREATE_INFO*, unsigned int*) /test/13.0_dbg_san/sql/handler.cc:6701:26
          #5 0x643d181fd38f in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*, bool) /test/13.0_dbg_san/sql/handler.cc:6774:15
          #6 0x643d19176028 in create_table_impl(THD*, st_ddl_log_state*, st_ddl_log_state*, Lex_ident_db const&, Lex_ident_table 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/13.0_dbg_san/sql/sql_table.cc:4982:11
          #7 0x643d191741f6 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/13.0_dbg_san/sql/sql_table.cc:5083:8
          #8 0x643d191c128f in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/13.0_dbg_san/sql/sql_table.cc:5329:7
          #9 0x643d191bc6ca in Sql_cmd_create_table_like::execute(THD*) /test/13.0_dbg_san/sql/sql_table.cc:13926:12
          #10 0x643d18df161d in mysql_execute_command(THD*, bool) /test/13.0_dbg_san/sql/sql_parse.cc:5905:26
          #11 0x643d18ddd699 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/13.0_dbg_san/sql/sql_parse.cc:7943:18
          #12 0x643d18dd69dc in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/13.0_dbg_san/sql/sql_parse.cc:1903:7
          #13 0x643d18ddede3 in do_command(THD*, bool) /test/13.0_dbg_san/sql/sql_parse.cc:1437:17
          #14 0x643d193d4abc in do_handle_one_connection(CONNECT*, bool) /test/13.0_dbg_san/sql/sql_connect.cc:1514:11
          #15 0x643d193d46d8 in handle_one_connection /test/13.0_dbg_san/sql/sql_connect.cc:1426:5
          #16 0x643d180bbb86 in asan_thread_start(void*) /test/llvm-build/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:246:28
          #17 0x7beb7609cb83 in start_thread nptl/pthread_create.c:447:8
          #18 0x7beb76129d6b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load /test/13.0_dbg_san/storage/connect/ha_connect.cc:1719:23 
      

      CS 13.0.2 1a4bb1bbfde5fa17ba148cb62678902f11c66a1a (Optimized, UBASAN, Clang 22.1.8-20260621) Build 12/08/2026

      /test/13.0_opt_san/storage/connect/ha_connect.cc:1719:23: runtime error: load of value 6, which is not a valid value for type 'bool'
          #0 0x6a0518e0050d in ha_connect::GetIndexOption(st_key*, char const*) /test/13.0_opt_san/storage/connect/ha_connect.cc
          #1 0x6a0518e06007 in ha_connect::GetIndexInfo(TABLE_SHARE*) /test/13.0_opt_san/storage/connect/ha_connect.cc:1808:19
          #2 0x6a0518e257bc in ha_connect::create(char const*, TABLE*, HA_CREATE_INFO*) /test/13.0_opt_san/storage/connect/ha_connect.cc:6921:15
          #3 0x62dae3b4e92c in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /test/13.0_opt_san/sql/handler.cc:6241:14
          #4 0x62dae3b5474f in ha_create_table_from_share(THD*, TABLE_SHARE*, HA_CREATE_INFO*, unsigned int*) /test/13.0_opt_san/sql/handler.cc:6701:26
          #5 0x62dae3b53589 in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*, bool) /test/13.0_opt_san/sql/handler.cc:6774:15
          #6 0x62dae49c81b8 in create_table_impl(THD*, st_ddl_log_state*, st_ddl_log_state*, Lex_ident_db const&, Lex_ident_table 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/13.0_opt_san/sql/sql_table.cc:4982:11
          #7 0x62dae49c6b3e 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/13.0_opt_san/sql/sql_table.cc:5083:8
          #8 0x62dae4a1075f in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/13.0_opt_san/sql/sql_table.cc:5329:7
          #9 0x62dae4a0cad5 in Sql_cmd_create_table_like::execute(THD*) /test/13.0_opt_san/sql/sql_table.cc:13926:12
          #10 0x62dae4676132 in mysql_execute_command(THD*, bool) /test/13.0_opt_san/sql/sql_parse.cc:5905:26
          #11 0x62dae4664074 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/13.0_opt_san/sql/sql_parse.cc:7943:18
          #12 0x62dae465d92f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/13.0_opt_san/sql/sql_parse.cc:1903:7
          #13 0x62dae4664e80 in do_command(THD*, bool) /test/13.0_opt_san/sql/sql_parse.cc:1437:17
          #14 0x62dae4c069ec in do_handle_one_connection(CONNECT*, bool) /test/13.0_opt_san/sql/sql_connect.cc:1514:11
          #15 0x62dae4c065b9 in handle_one_connection /test/13.0_opt_san/sql/sql_connect.cc:1426:5
          #16 0x62dae534cfd8 in pfs_spawn_thread /test/13.0_opt_san/storage/perfschema/pfs.cc:2198:3
          #17 0x62dae3a25a46 in asan_thread_start(void*) /test/llvm-build/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:246:28
          #18 0x76060009cb83 in start_thread nptl/pthread_create.c:447:8
          #19 0x760600129d6b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load /test/13.0_opt_san/storage/connect/ha_connect.cc:1719:23 
      

      Setup:

      Compiled with a recent version of Clang and LLVM. Ubuntu instructions for Clang/LLVM 18:
        # Note: It is strongly recommended to uninstall all old Clang & LLVM packages (ref  dpkg --list | grep -iE 'clang|llvm'  and use  apt purge  and  dpkg --purge  to remove the packages), before installing Clang/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 lld-18
      Compiled with: "-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C{,XX}_FLAGS='-O1 -march=native -mtune=native'" 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' 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
      

      SAN Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  120826  0931994096b84ecc9ffc8eb3517c7e09e6e8631e  No bug found                  
      CS  10.6   opt  120826  0931994096b84ecc9ffc8eb3517c7e09e6e8631e  No bug found                  
      CS  10.11  dbg  120826  aba2caa893cdfa880dbb9a4f2d8e6dfaa7ed8ebe  No bug found                  
      CS  10.11  opt  120826  aba2caa893cdfa880dbb9a4f2d8e6dfaa7ed8ebe  No bug found                  
      CS  11.4   dbg  120826  f6418ff7b2a0ecbc158f53331735994446bed0ac  No bug found                  
      CS  11.4   opt  120826  f6418ff7b2a0ecbc158f53331735994446bed0ac  No bug found                  
      CS  11.8   dbg  120826  da0beac410cc761be4ee52b90fded6c7fa2f8947  No bug found                  
      CS  11.8   opt  120826  da0beac410cc761be4ee52b90fded6c7fa2f8947  No bug found                  
      CS  12.3   dbg  120826  6b174bfb25be06f7efdab149183665e1a36b3dd5  No bug found                  
      CS  12.3   opt  120826  6b174bfb25be06f7efdab149183665e1a36b3dd5  No bug found                  
      CS  13.0   dbg  120826  1a4bb1bbfde5fa17ba148cb62678902f11c66a1a  UBSAN|load of value X, which is not a valid value for type 'bool'|storage/connect/ha_connect.cc|ha_connect::GetIndexOption|ha_connect::GetIndexInfo|ha_connect::create|handler::ha_create
      CS  13.0   opt  120826  1a4bb1bbfde5fa17ba148cb62678902f11c66a1a  UBSAN|load of value X, which is not a valid value for type 'bool'|storage/connect/ha_connect.cc|ha_connect::GetIndexOption|ha_connect::GetIndexInfo|ha_connect::create|handler::ha_create
      CS  13.1   dbg  120826  a217e1000f37a429a9c1d1c308952a959276b77e  No bug found                  
      CS  13.1   opt  120826  a217e1000f37a429a9c1d1c308952a959276b77e  No bug found                  
      ES  10.6   dbg  120826  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  10.6   opt  120826  fcecb2620f25965723d640decede7c018bcb1dcc  No bug found                  
      ES  11.4   dbg  120826  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.4   opt  120826  3b34189bfe675c18c4ced3ef531d016ea74c76f4  No bug found                  
      ES  11.8   dbg  120826  4694e931d10fecf733c34f83ea2146d31b708eb3  No bug found                  
      ES  11.8   opt  120826  4694e931d10fecf733c34f83ea2146d31b708eb3  No bug found                  
      ES  12.3   dbg  120826  ad4d36b69e4813957c35d5e148b93a51a61c91c6  No bug found                  
      ES  12.3   opt  120826  ad4d36b69e4813957c35d5e148b93a51a61c91c6  No bug found                  
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.25d
                0.25d

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.