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

UBSAN: UndefinedBehaviorSanitizer: function-type-mismatch in process_timers when using MAX_EXECUTION_TIME

Details

    Description

      SELECT /*+ MAX_EXECUTION_TIME(1)*/* FROM information_schema.routines;
      

      Leads to:

      bb-11.8-MDEV-35504-opt-hints CS 11.8.0 6d92aa1cf0a042e506189b6739e03a8b45e20ee7 (Optimized, UBASAN, Clang)

      /test/bb-11.8-MDEV-35504-opt-hints_opt_san/mysys/thr_timer.c:277:5: runtime error: call to function thd_kill_timeout through pointer to incorrect function type 'void (*)(void *)'
      /test/bb-11.8-MDEV-35504-opt-hints_opt_san/sql/sql_class.cc:618: note: thd_kill_timeout defined here
          #0 0x55587244ff88 in process_timers /test/bb-11.8-MDEV-35504-opt-hints_opt_san/mysys/thr_timer.c:277:5
          #1 0x55587244ff88 in timer_handler /test/bb-11.8-MDEV-35504-opt-hints_opt_san/mysys/thr_timer.c:322:7
          #2 0x55586f9ca1ec in asan_thread_start(void*) asan_interceptors.cpp.o
          #3 0x1530d5a9ca93 in start_thread nptl/pthread_create.c:447:8
          #4 0x1530d5b29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/bb-11.8-MDEV-35504-opt-hints_opt_san/mysys/thr_timer.c:277:5
      

      Setup:

      Compiled with a recent version of Clang (I used Clang 18.1.3) with LLVM 18. Ubuntu instructions:
           # Note: 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
      Compiled with: '-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++' 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'. For an example of UBSAN.filter, which includes current startup issues see: https://github.com/mariadb-corporation/mariadb-qa/blob/master/UBSAN.filter
      

      Attachments

        Issue Links

          Activity

            Also observed with other I_S queries. Can provide additional testcase if needed.

            Roel Roel Van de Paar added a comment - Also observed with other I_S queries. Can provide additional testcase if needed.

            I see that https://github.com/MariaDB/server/compare/bb-11.8-MDEV-35504-opt-hints...main is a bit outdated. preview-11.8-preview does not reproduce this issue. Perhaps upmerge 11.8 trunk/main into bb-11.8-MDEV-35504-opt-hints and I can retest?

            Roel Roel Van de Paar added a comment - I see that https://github.com/MariaDB/server/compare/bb-11.8-MDEV-35504-opt-hints...main is a bit outdated. preview-11.8-preview does not reproduce this issue. Perhaps upmerge 11.8 trunk/main into bb-11.8- MDEV-35504 -opt-hints and I can retest?
            oleg.smirnov Oleg Smirnov added a comment -

            Roel, good idea to upmerge. I pushed a new branch bb-11.8-MDEV-35504-opt-hints-v2 rebased on the current main. Please retest if possible

            oleg.smirnov Oleg Smirnov added a comment - Roel , good idea to upmerge. I pushed a new branch bb-11.8- MDEV-35504 -opt-hints-v2 rebased on the current main . Please retest if possible

            The issue is confirmed resolved in bb-11.8-MDEV-35504-opt-hints-v2, likely due to one of the many function-type-mismatch fixes in connection with MDEV-34348.

            Roel Roel Van de Paar added a comment - The issue is confirmed resolved in bb-11.8- MDEV-35504 -opt-hints-v2 , likely due to one of the many function-type-mismatch fixes in connection with MDEV-34348 .

            People

              oleg.smirnov Oleg Smirnov
              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.