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

UBSAN: runtime error: load of value 43, which is not a valid value for type 'bool' on I_S SELECT

    XMLWordPrintable

Details

    Description

      SELECT view_definition FROM information_schema.views;
      

      Leads to:

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/sql/sql_view.cc:1230:8: runtime error: load of value 43, which is not a valid value for type 'bool'
      SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load /test/10.5_dbg_san/sql/sql_view.cc:1230:8 
          #0 0x55a7906017d2 in mysql_make_view(THD*, TABLE_SHARE*, TABLE_LIST*, bool) /test/10.5_dbg_san/sql/sql_view.cc:1230:8
          #1 0x55a79018eefe in fill_schema_table_from_frm(THD*, st_mem_root*, TABLE*, st_schema_table*, st_mysql_const_lex_string*, st_mysql_const_lex_string*, Open_tables_backup*, bool) /test/10.5_dbg_san/sql/sql_show.cc:5039:9
          #2 0x55a790181c87 in get_all_tables(THD*, TABLE_LIST*, Item*) /test/10.5_dbg_san/sql/sql_show.cc:5320:20
          #3 0x55a7901f737a in get_schema_tables_result(JOIN*, enum_schema_table_state) /test/10.5_dbg_san/sql/sql_show.cc:9011:11
          #4 0x55a78fe72be9 in JOIN::exec_inner() /test/10.5_dbg_san/sql/sql_select.cc:4618:7
          #5 0x55a78fe6c8d1 in JOIN::exec() /test/10.5_dbg_san/sql/sql_select.cc:4441:3
          #6 0x55a78fd1b543 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /test/10.5_dbg_san/sql/sql_select.cc:4918:9
          #7 0x55a78fd170c7 in handle_select(THD*, LEX*, select_result*, unsigned long) /test/10.5_dbg_san/sql/sql_select.cc:449:10
          #8 0x55a78faf33f0 in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6437:12
          #9 0x55a78fa8759f in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4029:12
          #10 0x55a78fa2e4e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #11 0x55a78fa0e453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #12 0x55a78fa36a19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #13 0x55a7909b0f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #14 0x55a7909af6fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #15 0x55a78eeaaa8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #16 0x14a046c9ca93 in start_thread nptl/pthread_create.c:447:8
          #17 0x14a046d29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: invalid-bool-load /test/10.5_dbg_san/sql/sql_view.cc:1230:8 
      

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18:
      # llvm-17-linker-tools installs /usr/lib/llvm-17/lib/LLVMgold.so, which is needed for compilation, and LLVMgold.so is no longer included in LLVM 18
      sudo apt install clang llvm-18 llvm-18-linker-tools llvm-18-runtime llvm-18-tools llvm-18-dev libstdc++-14-dev llvm-dev llvm-17-linker-tools
      sudo ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      

      Bug confirmed present in:
      MariaDB: 10.5.28 (dbg), 10.6.21 (dbg), 10.11.11 (dbg), 11.4.5 (dbg), 11.7.1 (dbg), 11.8.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.28 (opt), 10.6.21 (opt), 10.11.11 (opt), 11.4.5 (opt), 11.7.1 (opt), 11.8.0 (opt)

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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