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

UBSAN runtime error: call to function io_callback(tpool::aiocb*)

Details

    Description

      On an UBSAN clang-15 build, if running with UBSAN option halt_on_error=1, MTR fails during mysqld --bootstrap, e.g.

      UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./mysql-test/mtr --suite=main
      

      with error

      ./tpool/task_group.cc:55:9: runtime error: call to function io_callback(tpool::aiocb*) through pointer to incorrect function type 'void (*)(void *)'
      ./storage/innobase/os/os0file.cc:3564: note: io_callback(tpool::aiocb*) defined here
          #0 0x55fa3fa9cef0 in tpool::task_group::execute(tpool::task*) ./tpool/task_group.cc:55:9
          #1 0x55fa3fa9db2f in tpool::task::execute() ./tpool/task.cc:47:16
          #2 0x55fa3fa88ee5 in tpool::thread_pool_generic::worker_main(tpool::worker_data*) ./tpool/tpool_generic.cc:599:11
          #3 0x55fa3fa974ce in void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:74:14
          #4 0x55fa3fa971e2 in std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96:14
          #5 0x55fa3fa9713d in void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:259:13
          #6 0x55fa3fa97026 in std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:266:11
          #7 0x55fa3fa96b14 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>>::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:211:13
          #8 0x7fc4f28dc252  (/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc252) (BuildId: e37fe1a879783838de78cbc8c80621fa685d58a2)
          #9 0x7fc4f2494ac2 in start_thread nptl/pthread_create.c:442:8
          #10 0x7fc4f252684f  misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ./tpool/task_group.cc:55:9 in
      

      Interestingly, without halt_on_error=1, I don't see the error at all.

      Attachments

        Activity

          bnestere Brandon Nesterenko created issue -
          bnestere Brandon Nesterenko made changes -
          Field Original Value New Value
          Description On an UBSAN clang-15 build, if running with UBSAN option halt_on_error=1, MTR fails during mysqld --bootstrap, e.g.
          {noformat}
          UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./mysql-test/mtr --suite=main
          {noformat}

          with error
          {noformat}
          ./tpool/task_group.cc:55:9: runtime error: call to function io_callback(tpool::aiocb*) through pointer to incorrect function type 'void (*)(void *)'
          ./storage/innobase/os/os0file.cc:3564: note: io_callback(tpool::aiocb*) defined here
              #0 0x55fa3fa9cef0 in tpool::task_group::execute(tpool::task*) ./tpool/task_group.cc:55:9
              #1 0x55fa3fa9db2f in tpool::task::execute() ./tpool/task.cc:47:16
              #2 0x55fa3fa88ee5 in tpool::thread_pool_generic::worker_main(tpool::worker_data*) ./tpool/tpool_generic.cc:599:11
              #3 0x55fa3fa974ce in void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:74:14
              #4 0x55fa3fa971e2 in std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96:14
              #5 0x55fa3fa9713d in void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:259:13
              #6 0x55fa3fa97026 in std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:266:11
              #7 0x55fa3fa96b14 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>>::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:211:13
              #8 0x7fc4f28dc252 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc252) (BuildId: e37fe1a879783838de78cbc8c80621fa685d58a2)
              #9 0x7fc4f2494ac2 in start_thread nptl/pthread_create.c:442:8
              #10 0x7fc4f252684f misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

          SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ./tpool/task_group.cc:55:9 in
          {noformat}
          On an UBSAN clang-15 build, if running with UBSAN option halt_on_error=1, MTR fails during mysqld --bootstrap, e.g.
          {noformat}
          UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./mysql-test/mtr --suite=main
          {noformat}

          with error
          {noformat}
          ./tpool/task_group.cc:55:9: runtime error: call to function io_callback(tpool::aiocb*) through pointer to incorrect function type 'void (*)(void *)'
          ./storage/innobase/os/os0file.cc:3564: note: io_callback(tpool::aiocb*) defined here
              #0 0x55fa3fa9cef0 in tpool::task_group::execute(tpool::task*) ./tpool/task_group.cc:55:9
              #1 0x55fa3fa9db2f in tpool::task::execute() ./tpool/task.cc:47:16
              #2 0x55fa3fa88ee5 in tpool::thread_pool_generic::worker_main(tpool::worker_data*) ./tpool/tpool_generic.cc:599:11
              #3 0x55fa3fa974ce in void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:74:14
              #4 0x55fa3fa971e2 in std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96:14
              #5 0x55fa3fa9713d in void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:259:13
              #6 0x55fa3fa97026 in std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:266:11
              #7 0x55fa3fa96b14 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>>>::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:211:13
              #8 0x7fc4f28dc252 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc252) (BuildId: e37fe1a879783838de78cbc8c80621fa685d58a2)
              #9 0x7fc4f2494ac2 in start_thread nptl/pthread_create.c:442:8
              #10 0x7fc4f252684f misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

          SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ./tpool/task_group.cc:55:9 in
          {noformat}

          Interestingly, without halt_on_error=1, I don't see the error at all.
          bnestere Brandon Nesterenko made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          bnestere Brandon Nesterenko made changes -
          Assignee Brandon Nesterenko [ JIRAUSER48702 ] Marko Mäkelä [ marko ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          marko Marko Mäkelä made changes -
          issue.field.resolutiondate 2024-06-12 05:40:31.0 2024-06-12 05:40:30.68
          marko Marko Mäkelä made changes -
          Fix Version/s 10.5.26 [ 29832 ]
          Fix Version/s 10.6.19 [ 29833 ]
          Fix Version/s 10.11.9 [ 29834 ]
          Fix Version/s 11.1.6 [ 29835 ]
          Fix Version/s 11.2.5 [ 29836 ]
          Fix Version/s 11.4.3 [ 29837 ]
          Fix Version/s 11.5.2 [ 29838 ]
          Fix Version/s 10.5 [ 23123 ]
          Assignee Marko Mäkelä [ marko ] Brandon Nesterenko [ JIRAUSER48702 ]
          Resolution Fixed [ 1 ]
          Status In Review [ 10002 ] Closed [ 6 ]

          People

            bnestere Brandon Nesterenko
            bnestere Brandon Nesterenko
            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.