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

On startup: UBSAN: runtime error: applying zero offset to null pointer in skip_trailing_space and my_hash_sort_utf8mb3_general1400_nopad_as_ci

    XMLWordPrintable

Details

    Description

      When compiling 11.5 with Clang for an UB+ASAN build, on startup we see:

      11.5.0 e4afa610539ae01164485554e2de839bea9de816 (Optimized, UBASAN)

      /test/11.5_opt_san/strings/strings_def.h:83:25: runtime error: applying zero offset to null pointer
          #0 0x560775ce5cab in skip_trailing_space /test/11.5_opt_san/strings/strings_def.h:83:25
          #1 0x560775ce9de9 in my_hash_sort_utf8mb3_general1400_as_ci /test/11.5_opt_san/strings/ctype-utf8.c:567:19
          #2 0x560775b2038d in my_ci_hash_sort /test/11.5_opt_san/include/m_ctype.h:1413:3
          #3 0x560775b2038d in my_hash_sort /test/11.5_opt_san/mysys/hash.c:48:3
          #4 0x560775b21f2f in my_hash_insert /test/11.5_opt_san/mysys/hash.c:405:20
          #5 0x5607743c1c0b in Native_functions_hash::append(Native_func_registry const*, unsigned long) /test/11.5_opt_san/sql/item_create.cc:6516:9
          #6 0x5607743c1c0b in Native_functions_hash::replace(Native_func_registry const*, unsigned long) /test/11.5_opt_san/sql/item_create.h:331:5
          #7 0x5607743c1a3f in item_create_init() /test/11.5_opt_san/sql/item_create.cc:6632:34
          #8 0x56077291bdc5 in init_common_variables() /test/11.5_opt_san/sql/mysqld.cc:4145:7
          #9 0x5607729160cd in mysqld_main(int, char**) /test/11.5_opt_san/sql/mysqld.cc:5747:7
          #10 0x14bbe48280cf in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #11 0x14bbe4828188 in __libc_start_main csu/../csu/libc-start.c:360:3
          #12 0x560772833a74 in _start (/test/UBASAN_MD170524-mariadb-11.5.0-linux-x86_64-opt/bin/mariadbd+0x1eeaa74) (BuildId: 625cf9b723786356a41e5db3b224cfc14cafba37)
       
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /test/11.5_opt_san/strings/strings_def.h:83:25 in 
      /test/11.5_opt_san/strings/ctype-utf8.c:547:21: runtime error: applying zero offset to null pointer
          #0 0x560775cea26b in my_hash_sort_utf8mb3_general1400_nopad_as_ci /test/11.5_opt_san/strings/ctype-utf8.c:547:21
          #1 0x560775cea26b in my_hash_sort_utf8mb3_general1400_as_ci /test/11.5_opt_san/strings/ctype-utf8.c:568:3
          #2 0x560775b2038d in my_ci_hash_sort /test/11.5_opt_san/include/m_ctype.h:1413:3
          #3 0x560775b2038d in my_hash_sort /test/11.5_opt_san/mysys/hash.c:48:3
          #4 0x560775b21f2f in my_hash_insert /test/11.5_opt_san/mysys/hash.c:405:20
          #5 0x5607743c1c0b in Native_functions_hash::append(Native_func_registry const*, unsigned long) /test/11.5_opt_san/sql/item_create.cc:6516:9
          #6 0x5607743c1c0b in Native_functions_hash::replace(Native_func_registry const*, unsigned long) /test/11.5_opt_san/sql/item_create.h:331:5
          #7 0x5607743c1a3f in item_create_init() /test/11.5_opt_san/sql/item_create.cc:6632:34
          #8 0x56077291bdc5 in init_common_variables() /test/11.5_opt_san/sql/mysqld.cc:4145:7
          #9 0x5607729160cd in mysqld_main(int, char**) /test/11.5_opt_san/sql/mysqld.cc:5747:7
          #10 0x14bbe48280cf in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #11 0x14bbe4828188 in __libc_start_main csu/../csu/libc-start.c:360:3
          #12 0x560772833a74 in _start (/test/UBASAN_MD170524-mariadb-11.5.0-linux-x86_64-opt/bin/mariadbd+0x1eeaa74) (BuildId: 625cf9b723786356a41e5db3b224cfc14cafba37)
       
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /test/11.5_opt_san/strings/ctype-utf8.c:547:21 in 
      

      This blocks UBSAN testing using Clang-compiled builds.

      $ cat BUILD_CMD_CMAKE 
      cmake . -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DWITH_SSL=bundled -DBUILD_CONFIG=mysql_release -DWITH_TOKUDB=0 -DWITH_JEMALLOC=no -DFEATURE_SET=community -DDEBUG_EXTNAME=OFF -DWITH_EMBEDDED_SERVER=0 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost_902208 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DWITH_SAFEMALLOC=OFF -DPLUGIN_PERFSCHEMA=NO -DWITH_DBUG_TRACE=OFF -DWITH_ZLIB=bundled -DWITH_ROCKSDB=1 -DWITH_PAM=ON -DWITH_MARIABACKUP=0 -DFORCE_INSOURCE_BUILD=1 -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWSREP_LIB_WITH_ASAN=ON -DCMAKE_CXX_FLAGS=-fsanitize-coverage=trace-pc-guard -DMYSQL_MAINTAINER_MODE=OFF -DWARNING_AS_ERROR='' -DCMAKE_BUILD_TYPE=RelWithDebInfo
      

      export UBSAN_OPTIONS=print_stacktrace=1
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.