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

UBSAN runtime error: function-type-mismatch: call to function (unknown) through pointer to incorrect function type in libmariadb/plugins/auth/my_auth.c on client startup

    XMLWordPrintable

Details

    Description

      $ ./bin/mariadb -uroot --socket=${PWD}/socket.sock
      

      Leads to:

      CS 10.5.28 773cb726a8437d911d3f7ceedf4839dab6124484 (Debug, UBASAN)

      /test/clang_new/10.5_dbg_san/libmariadb/plugins/auth/my_auth.c:94:9: runtime error: call to function (unknown) through pointer to incorrect function type 'int (*)(struct st_plugin_vio *, const unsigned char *, int)'
      (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x5ce828): note: (unknown) defined here
          #0 0x5635f274160c  (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x5cb60c) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #1 0x5635f2742e4c in run_plugin_auth (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x5cce4c) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #2 0x5635f2620b2c in mthd_my_real_connect (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x4aab2c) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #3 0x5635f2618394 in mysql_real_connect (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x4a2394) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #4 0x5635f25c6e3a  (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x450e3a) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #5 0x5635f25d5bcc  (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x45fbcc) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #6 0x5635f259b812  (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x425812) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #7 0x5635f25989c0 in main (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x4229c0) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
          #8 0x153180c2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
          #9 0x153180c2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
          #10 0x5635f24b7ca4 in _start (/test/CLANG_UBASAN_MD251124-mariadb-10.5.28-linux-x86_64-dbg/bin/mariadb+0x341ca4) (BuildId: 11e9790fec8b3dff9cd05600a31d9a48007bd9ae)
       
      SUMMARY: UndefinedBehaviorSanitizer: function-type-mismatch /test/clang_new/10.5_dbg_san/libmariadb/plugins/auth/my_auth.c:94:9 
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 4
      Server version: 10.5.28-MariaDB-debug MariaDB Server
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> 
      

      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
      

      Attachments

        Issue Links

          Activity

            People

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