Bug 446139 - DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared_until false positives
Summary: DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: drd (other bugs)
Version First Reported In: 3.19 GIT
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Bart Van Assche
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-26 21:32 UTC by Paul Floyd
Modified: 2021-12-01 23:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
testcase (1.39 KB, text/x-c++src)
2021-11-26 21:32 UTC, Paul Floyd
Details
initial patch (8.52 KB, patch)
2021-11-26 21:34 UTC, Paul Floyd
Details
full patch with testcases (15.64 KB, patch)
2021-11-27 21:07 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2021-11-26 21:32:23 UTC
Created attachment 143984 [details]
testcase

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

Again on Fedora 34

This time it is pthread_rwlock_clockrdlock and pthread_rwlock_clockrwrlock that do not have intercepts.

This gives several false positives e.g. Helgrind
==16048== Thread #3 unlocked lock at 0x406220 currently held by thread #1
==16048==    at 0x484A573: pthread_rwlock_unlock_WRK (hg_intercepts.c:2683)
==16048==    by 0x484CA97: pthread_rwlock_unlock (hg_intercepts.c:2702)

and DRD

==16064== Reader-writer lock not locked by calling thread: rwlock 0x406220.
==16064==    at 0x486722B: pthread_rwlock_unlock_intercept (drd_pthread_intercepts.c:1855)
==16064==    by 0x486722B: pthread_rwlock_unlock (drd_pthread_intercepts.c:1869)
Comment 1 Paul Floyd 2021-11-26 21:34:09 UTC
Created attachment 143985 [details]
initial patch

Suggested patch for this and 446138
Comment 2 Paul Floyd 2021-11-27 21:07:48 UTC
Created attachment 144011 [details]
full patch with testcases

Helgrind/DRD now function with this patch
Comment 3 Paul Floyd 2021-11-27 21:09:08 UTC
Mark, you might want to backport this one on Fedora also.
Comment 4 Paul Floyd 2021-12-01 23:21:09 UTC
Committed with
commit c2607e093c54abe473b1d419cbdbba403cc87cdf