-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analysis of pthread_cond
#520
Conversation
You would just conditionally have to not make the EDIT: Sorry, I see what you mean now. I was looking at the mutex analysis where the splits are made, but you mean making it dead from another analysis. |
Actually, I am starting to wonder if improving the Race Detection with this information is actually something that we want to do. The standard allows for spurious wakeups, so if a race is only excluded due to these conditions on condition variables, the race is still there in fact (!). So maybe this information should be computed, but the race still reported with something such as (condition variable And for the reporting of code as dead, probably a warning should be generated that says only alive due to spurious wakeup or something... At least there should be an option to toggle how we handle spurious wakeups. |
I would propose to leave the TODOs as is for now, as we have thus far not come up with a convincing use case yet. We can already detect an interesting class of bugs with this analysis, namely code that is only alive due to spurious wakeup, which already is an interesting concurrency bug. |
I switched the analysis to use the full power of MHP. This is both more powerful, and allows removing a lot of duplicated code. I made the assumption that only few signals typically happen in programs for a given condition variable and that correspondingly the sets of MHP information at globals do not get too large. |
Co-authored-by: Simmo Saan <simmo.saan@gmail.com>
Pthreads uses condition variables or synchronization (e.g.
signal
,broadcast
,wait
, ...). So far we do not really do anything meaningful for them, however there are some possible uses:Detecting more Dead Code
cv
is never signaled, making everything pastpthread_cond_wait(cv)
dead.cv
are all:pthread_cond_wait(cv)
.pthread_cond_wait(cv)
is reached, thus meaning they can not be the signalerImproving Race Detection
t1
andt2
wheret2
has observed signal (Must-Received)cv
and all the threads signallingcv
are not started at this location int1
yet. If one additionally collects May-Sent-Signal sets, one can also exclude cases wheret1
is the one that will signal but has not reached that program point yet.Improving Privatization
Things that are TODO here:
RaisingDeadcode
duringspecial
forpthread_cond_wait
does not work, probably related to thesplit
andevent
business inmutexAnalysis.ml
. Any ideas there @sim642?Implement the Race Detection part of this PRDream up improved Privatization schemes