https://bugs.kde.org/show_bug.cgi?id=446138

            Bug ID: 446138
           Summary: DRD/Helgrind with std::timed_mutex::try_lock_until
           Product: valgrind
           Version: 3.19 GIT
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: drd
          Assignee: bart.vanassche+...@gmail.com
          Reporter: pjfl...@wanadoo.fr
  Target Milestone: ---

Created attachment 143983
  --> https://bugs.kde.org/attachment.cgi?id=143983&action=edit
testcase using std::timed_mutex::try_lock_until

On Fedora 34 the attached testcase uses pthread_mutex_clocklock, which has no
DRD or Helgrind mutex.

Consequently with Helgrind
==15537== Thread #2 unlocked an invalid lock at 0x4050E0
==15537==    at 0x4848ABA: mutex_unlock_WRK (hg_intercepts.c:1130)
==15537==    by 0x484C516: pthread_mutex_unlock (hg_intercepts.c:1151)
==15537==    by 0x401414: __gthread_mutex_unlock(pthread_mutex_t*)
(gthr-default.h:779)
==15537==    by 0x401509: std::timed_mutex::unlock() (mutex:255)
==15537==    by 0x401291: f() (try_lock_until1.cpp:15)
==15537==    by 0x401F30: void std::__invoke_impl<void, void
(*)()>(std::__invoke_other, void (*&&)()) (invoke.h:61)
==15537==    by 0x401EE8: std::__invoke_result<void (*)()>::type
std::__invoke<void (*)()>(void (*&&)()) (invoke.h:96)
==15537==    by 0x401E95: void std::thread::_Invoker<std::tuple<void (*)()>
>::_M_invoke<0ul>(std::_Index_tuple<0ul>) (std_thread.h:253)
==15537==    by 0x401E69: std::thread::_Invoker<std::tuple<void (*)()>
>::operator()() (std_thread.h:260)
==15537==    by 0x401E4D:
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> >
>::_M_run() (std_thread.h:211)
==15537==    by 0x4953C83: execute_native_thread_routine (thread.cc:82)
==15537==    by 0x484B1CC: mythread_wrapper (hg_intercepts.c:406)

and DRD
==15571== The object at address 0x4050e0 is not a mutex.
==15571==    at 0x4855018: pthread_mutex_unlock_intercept
(drd_pthread_intercepts.c:1025)
==15571==    by 0x4855018: pthread_mutex_unlock (drd_pthread_intercepts.c:1038)
==15571==    by 0x401414: __gthread_mutex_unlock(pthread_mutex_t*)
(gthr-default.h:779)
==15571==    by 0x401509: std::timed_mutex::unlock() (mutex:255)
==15571==    by 0x40131C: main (try_lock_until1.cpp:25)
==15571== 
==15571== Thread 2:
==15571== The object at address 0x4050e0 is not a mutex.
==15571==    at 0x4855018: pthread_mutex_unlock_intercept
(drd_pthread_intercepts.c:1025)
==15571==    by 0x4855018: pthread_mutex_unlock (drd_pthread_intercepts.c:1038)
==15571==    by 0x401414: __gthread_mutex_unlock(pthread_mutex_t*)
(gthr-default.h:779)
==15571==    by 0x401509: std::timed_mutex::unlock() (mutex:255)
==15571==    by 0x401291: f() (try_lock_until1.cpp:15)
==15571==    by 0x401F30: void std::__invoke_impl<void, void
(*)()>(std::__invoke_other, void (*&&)()) (invoke.h:61)
==15571==    by 0x401EE8: std::__invoke_result<void (*)()>::type
std::__invoke<void (*)()>(void (*&&)()) (invoke.h:96)
==15571==    by 0x401E95: void std::thread::_Invoker<std::tuple<void (*)()>
>::_M_invoke<0ul>(std::_Index_tuple<0ul>) (std_thread.h:253)
==15571==    by 0x401E69: std::thread::_Invoker<std::tuple<void (*)()>
>::operator()() (std_thread.h:260)
==15571==    by 0x401E4D:
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> >
>::_M_run() (std_thread.h:211)
==15571==    by 0x4971C83: execute_native_thread_routine (thread.cc:82)
==15571==    by 0x484BC5A: vgDrd_thread_wrapper (drd_pthread_intercepts.c:491)
==15571==    by 0x4C1F298: start_thread (pthread_create.c:481)

Adding intercepts for pthread_mutex_clocklock fixes the issue.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to