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

UBSAN: invalid-shift-exponent: shift exponent 32 is too large for 32-bit type 'int' in myrocks::ha_rocksdb::info

Details

    Description

      In the same area, but different from MDEV-22305 we have:

      INSTALL SONAME 'ha_rocksdb';
      CREATE TABLE t (c1 INT,c2 INT,c3 INT,c4 INT,c5 INT,c6 INT,c7 INT,c8 INT,c9 INT,c10 INT,c11 INT,c12 INT,c13 INT,c14 INT,c15 INT,c16 INT,c17 INT,c18 INT,c19 INT,c20 INT,c21 INT,c22 INT,c23 INT,c24 INT,c25 INT,c26 INT,c27 INT,c28 INT,c29 INT,c30 INT,c31 INT,c32 INT,KEY(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32)) ENGINE=RocksDB;
      SELECT * FROM t;
      

      Leads to:

      CS 10.5.29 c43d0a015f974c5a0142e6779332089a7a979853 (Debug, UBASAN, Clang) Build 15/02/2025

      /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:11100:17: runtime error: shift exponent 32 is too large for 32-bit type 'int'
          #0 0x7c0d0f27040b in myrocks::ha_rocksdb::info(unsigned int) /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:11100:17
          #1 0x7c0d0f231ec0 in myrocks::ha_rocksdb::open(char const*, int, unsigned int) /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:6843:3
          #2 0x58bce3864cdd in handler::ha_open(TABLE*, char const*, int, unsigned int, st_mem_root*, List<String>*) /test/10.5_dbg_san/sql/handler.cc:3106:7
          #3 0x58bce3054806 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:4351:33
          #4 0x58bce28f9b7e in open_table(THD*, TABLE_LIST*, Open_table_context*) /test/10.5_dbg_san/sql/sql_base.cc:2044:12
          #5 0x58bce2907147 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:3839:14
          #6 0x58bce2907147 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:4323:14
          #7 0x58bce2913f24 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:5270:7
          #8 0x58bce2a8ad2e in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /test/10.5_dbg_san/sql/sql_base.h:509:10
          #9 0x58bce2bc29ec in execute_sqlcom_select(THD*, TABLE_LIST*) /test/10.5_dbg_san/sql/sql_parse.cc:6373:14
          #10 0x58bce2bac242 in mysql_execute_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:4043:12
          #11 0x58bce2b7c467 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:8252:18
          #12 0x58bce2b703b9 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /test/10.5_dbg_san/sql/sql_parse.cc:1891:7
          #13 0x58bce2b7e5be in do_command(THD*) /test/10.5_dbg_san/sql/sql_parse.cc:1375:17
          #14 0x58bce3188257 in do_handle_one_connection(CONNECT*, bool) /test/10.5_dbg_san/sql/sql_connect.cc:1386:11
          #15 0x58bce3187b1b in handle_one_connection /test/10.5_dbg_san/sql/sql_connect.cc:1298:5
          #16 0x58bce269103c in asan_thread_start(void*) asan_interceptors.cpp.o
          #17 0x7c0d5a29ca93 in start_thread nptl/pthread_create.c:447:8
          #18 0x7c0d5a329c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: invalid-shift-exponent /test/10.5_dbg_san/storage/rocksdb/ha_rocksdb.cc:11100:17 
      

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18. Ubuntu instructions:
        # 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
      Compiled with: "-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C{,XX}_FLAGS='-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.5   dbg  150225  c43d0a015f974c5a0142e6779332089a7a979853  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  10.5   opt  150225  c43d0a015f974c5a0142e6779332089a7a979853  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  10.6   dbg  150225  f1d7e0c17e33f77278e6226dd94aeb30fc856bf0  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  10.6   opt  150225  f1d7e0c17e33f77278e6226dd94aeb30fc856bf0  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  10.11  dbg  150225  43c5d1303f5c7c726db276815c459436110f342f  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  10.11  opt  150225  43c5d1303f5c7c726db276815c459436110f342f  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  11.4   dbg  150225  ef966af801afc2a07222b5df65dddd52c77431dd  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  11.4   opt  150225  ef966af801afc2a07222b5df65dddd52c77431dd  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  11.8   dbg  150225  33e0796e7a154e02a5e53c55cefc5d6feb4f5e6d  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  11.8   opt  150225  33e0796e7a154e02a5e53c55cefc5d6feb4f5e6d  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  12.0   dbg  150225  c92add291e636c797e6d6ddca605905541b2a441  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      CS  12.0   opt  150225  c92add291e636c797e6d6ddca605905541b2a441  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      ES  10.5   dbg  140325  6553c62369ab3606efc74295c902181f793fd6d1  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      ES  10.5   opt  140325  6553c62369ab3606efc74295c902181f793fd6d1  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      ES  10.6   dbg  140325  a99e9e4101f5d56a379577e6d81c829b7658df99  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      ES  10.6   opt  140325  a99e9e4101f5d56a379577e6d81c829b7658df99  UBSAN|member access within null pointer of type 'KEY' (aka 'st_key')|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::check_keyread_allowed|myrocks::ha_rocksdb::index_flags|TABLE_SHARE::init_from_binary_frm_image|ha_create_table
      ES  11.4   dbg  140325  26e39c99feaa4e6f9d3e1b13fd4a7d101059b7ba  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      ES  11.4   opt  140325  26e39c99feaa4e6f9d3e1b13fd4a7d101059b7ba  UBSAN|shift exponent X is too large for 32-bit type 'int'|storage/rocksdb/ha_rocksdb.cc|myrocks::ha_rocksdb::info|myrocks::ha_rocksdb::open|handler::ha_open|open_table_from_share
      

      For the single ES 10.6 opt different stack alone, see MENT-2277. It is otherwise unrelated to this ticket.

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            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.