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

UBSAN: runtime error: applying non-zero offset 32 to null pointer

    XMLWordPrintable

Details

    Description

      Looks related to MDEV-23956 and MDEV-21799, however this is a new UBSAN issue with a new stack.

      INSTALL SONAME 'ha_rocksdb';
      CREATE TABLE t (a INT,KEY(a)) ENGINE=RocksDB;
      

      Leads to:

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Optimized, UBASAN, Clang)

      /test/10.5_opt_san/storage/rocksdb/rdb_datadic.cc:550:17: runtime error: applying non-zero offset 32 to null pointer
          #0 0x146da8200355 in myrocks::Rdb_key_def::setup(TABLE const*, myrocks::Rdb_tbl_def const*) /test/10.5_opt_san/storage/rocksdb/rdb_datadic.cc:550:17
          #1 0x146da8099ab3 in myrocks::ha_rocksdb::create_key_def(TABLE const*, unsigned int, myrocks::Rdb_tbl_def const*, std::shared_ptr<myrocks::Rdb_key_def>*, myrocks::ha_rocksdb::key_def_cf_info const&, unsigned long long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const /test/10.5_opt_san/storage/rocksdb/ha_rocksdb.cc:7581:19
          #2 0x146da8096a41 in myrocks::ha_rocksdb::create_key_defs(TABLE const*, myrocks::Rdb_tbl_def*, TABLE const*, myrocks::Rdb_tbl_def const*) const /test/10.5_opt_san/storage/rocksdb/ha_rocksdb.cc:7172:11
          #3 0x146da809f925 in myrocks::ha_rocksdb::create_table(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, TABLE const*, unsigned long long) /test/10.5_opt_san/storage/rocksdb/ha_rocksdb.cc:7759:9
          #4 0x146da80a1873 in myrocks::ha_rocksdb::create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.5_opt_san/storage/rocksdb/ha_rocksdb.cc:7905:3
          #5 0x55bfd97e7854 in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.5_opt_san/sql/handler.cc:5239:14
          #6 0x55bfd97efd84 in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /test/10.5_opt_san/sql/handler.cc:5705:22
          #7 0x55bfd8cdf6c6 in create_table_impl(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, char const*, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*) /test/10.5_opt_san/sql/sql_table.cc:5451:11
          #8 0x55bfd8cdd7ca in mysql_create_table_no_lock(THD*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /test/10.5_opt_san/sql/sql_table.cc:5536:8
          #9 0x55bfd8ce2220 in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.5_opt_san/sql/sql_table.cc:5749:7
          #10 0x55bfd8d45cf8 in Sql_cmd_create_table_like::execute(THD*) /test/10.5_opt_san/sql/sql_table.cc:12681:12
          #11 0x55bfd88cdc0a in mysql_execute_command(THD*) /test/10.5_opt_san/sql/sql_parse.cc:6179:26
          #12 0x55bfd889e168 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_opt_san/sql/sql_parse.cc:8237:18
          #13 0x55bfd8891160 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_opt_san/sql/sql_parse.cc:1891:7
          #14 0x55bfd88a0ba9 in do_command(THD*) /test/10.5_opt_san/sql/sql_parse.cc:1375:17
          #15 0x55bfd8fa6f72 in do_handle_one_connection(CONNECT*, bool) /test/10.5_opt_san/sql/sql_connect.cc:1386:11
          #16 0x55bfd8fa63d4 in handle_one_connection /test/10.5_opt_san/sql/sql_connect.cc:1298:5
          #17 0x55bfd830710c in asan_thread_start(void*) asan_interceptors.cpp.o
          #18 0x146dda69ca93 in start_thread nptl/pthread_create.c:447:8
          #19 0x146dda729c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset /test/10.5_opt_san/storage/rocksdb/rdb_datadic.cc:550:17
      

      CS 10.5.28 142851f1205d98270b917a98e1bdd483e1b8af0e (Debug, UBASAN, Clang)

      /test/10.5_dbg_san/storage/rocksdb/rdb_datadic.cc:550:17: runtime error: applying non-zero offset 32 to null pointer
          #0 0x14c1cc752abb in myrocks::Rdb_key_def::setup(TABLE const*, myrocks::Rdb_tbl_def const*) /test/10.5_dbg_san/storage/rocksdb/rdb_datadic.cc:550:17
          #1 0x14c1cc39c65b in myrocks::ha_rocksdb::create_key_def(TABLE const*, unsigned int, myrocks::Rdb_tbl_def const*, std::shared_ptr<myrocks::Rdb_key_def>*, myrocks::ha_rocksdb::key_def_cf_info const&, unsigned long long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:7581:19
          #2 0x14c1cc39820c in myrocks::ha_rocksdb::create_key_defs(TABLE const*, myrocks::Rdb_tbl_def*, TABLE const*, myrocks::Rdb_tbl_def const*) const /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:7172:11
          #3 0x14c1cc3ac151 in myrocks::ha_rocksdb::create_table(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, TABLE const*, unsigned long long) /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:7759:9
          #4 0x14c1cc3b02c3 in myrocks::ha_rocksdb::create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:7905:3
          #5 0x564fcd68ce0e in handler::ha_create(char const*, TABLE*, HA_CREATE_INFO*) /test/10.5_dbg_san/sql/handler.cc:5239:14
          #6 0x564fcd6a08b5 in ha_create_table(THD*, char const*, char const*, char const*, HA_CREATE_INFO*, st_mysql_const_unsigned_lex_string*) /test/10.5_dbg_san/sql/handler.cc:5705:22
          #7 0x564fcbdd047d in create_table_impl(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, char const*, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*) /test/10.5_dbg_san/sql/sql_table.cc:5451:11
          #8 0x564fcbdc918a in mysql_create_table_no_lock(THD*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_table.cc:5536:8
          #9 0x564fcbdd5fbf in mysql_create_table(THD*, TABLE_LIST*, Table_specification_st*, Alter_info*) /test/10.5_dbg_san/sql/sql_table.cc:5749:7
          #10 0x564fcbeacc97 in Sql_cmd_create_table_like::execute(THD*) /test/10.5_dbg_san/sql/sql_table.cc:12681:12
          #11 0x564fcb52bfb0 in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:6179:26
          #12 0x564fcb47e4e3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8237:18
          #13 0x564fcb45e453 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #14 0x564fcb486a19 in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #15 0x564fcc400f30 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #16 0x564fcc3ff6fd in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #17 0x564fca8faa8c in asan_thread_start(void*) asan_interceptors.cpp.o
          #18 0x14c20649ca93 in start_thread nptl/pthread_create.c:447:8
          #19 0x14c206529c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset /test/10.5_dbg_san/storage/rocksdb/rdb_datadic.cc:550:17
      

      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.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

            People

              psergei Sergei Petrunia
              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.