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

UBSAN: runtime error: call to function free_acl_user(ACL_USER*) through pointer to incorrect function type

    XMLWordPrintable

Details

    Description

      export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      rm -Rf data tmp 
      mkdir tmp 
      ./scripts/mariadb-install-db --no-defaults --force --auth-root-authentication-method=normal --basedir=${PWD} --tmpdir=${PWD}/tmp --datadir=${PWD}/data
      

      Leads to:

      CS 11.4.5 866a8ea6736d2edc0f6be552d1cdd6810c10d5ab (Debug, UBASAN)

      /test/11.4_dbg_san/mysys/array.c:382:5: runtime error: call to function free_acl_user(ACL_USER*) through pointer to incorrect function type 'void (*)(void *)'
      /test/11.4_dbg_san/sql/sql_acl.cc:2264: note: free_acl_user(ACL_USER*) defined here
          #0 0x558e6ebb3a0d in delete_dynamic_with_callback /test/11.4_dbg_san/mysys/array.c:382:5
          #1 0x558e683e7e3f in acl_free(bool) /test/11.4_dbg_san/sql/sql_acl.cc:2918:3
          #2 0x558e67e4c949 in clean_up(bool) /test/11.4_dbg_san/sql/mysqld.cc:1988:3
          #3 0x558e67e5aae7 in mysqld_main(int, char**) /test/11.4_dbg_san/sql/mysqld.cc:6105:3
          #4 0x558e67e438b3 in main /test/11.4_dbg_san/sql/main.cc:34:10
          #5 0x14ff5602a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #6 0x14ff5602a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #7 0x558e67d68084 in _start (/test/UBASAN_MD271124-mariadb-11.4.5-linux-x86_64-dbg/bin/mariadbd+0x412a084) (BuildId: 457f3d994c8914000e781d9d568f5e103246b60c)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/11.4_dbg_san/mysys/array.c:382:5
      

      Observed using UBSAN with Clang and LLMV 18.1.3:

      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  # 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 ln -s /usr/lib/llvm-17/lib/LLVMgold.so /usr/lib/llvm-18/lib/LLVMgold.so
      ...
      export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
      

      This bug will likely be fixed by the upmerge of the MDEV-34348 to 11.4. Logging as we have a filter in place for function:delete_dynamic_with_callback, which will be removed if MDEV-34348 fixes the bug.

      Attachments

        Activity

          People

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