[llvm-bugs] [Bug 32455] New: False Positive PthreadLockChecker Use destroyed lock
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 29 02:19:45 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32455
Bug ID: 32455
Summary: False Positive PthreadLockChecker Use destroyed lock
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: xiangzhai83 at gmail.com
CC: llvm-bugs at lists.llvm.org
Hi LLVM developers,
Testcase: libburn
https://dev.lovelyhq.com/libburnia/libburn/blob/master/libburn/libdax_msgs.c#L209
208 #ifndef LIBDAX_MSGS_SINGLE_THREADED
209 if(pthread_mutex_destroy(&(o->lock_mutex))!=0) {
^
Assuming the condition is true
^
Taking true branch
210 pthread_mutex_unlock(&(o->lock_mutex));
^
This lock has already been destroyed
211 pthread_mutex_destroy(&(o->lock_mutex));
212 }
213 #endif
But if the return value of pthread_mutex_destroy is NOT 0
https://github.molgen.mpg.de/git-mirror/glibc/blob/master/nptl/pthread_mutex_destroy.c#L32
then mutex->__data.__kind will not be set! so it might be still able to use
pthread_mutex_unlock to set mutex object's members
https://github.molgen.mpg.de/git-mirror/glibc/blob/master/nptl/pthread_mutex_unlock.c#L49
Regards,
Leslie Zhai
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170329/dfad6fce/attachment.html>
More information about the llvm-bugs
mailing list