-
Notifications
You must be signed in to change notification settings - Fork 76
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
Exclude free-free accesses from racing #1193
Conversation
That might've been too eager. I think the reason we consider free-free as racing is that, even though But that makes me wonder, what does the |
It does not do too much extra, except that it checks that the freeing thread may not run in parallel (disregarding mutexes, as that is not relevant for use-after-free and double-free, as free and access do not need to happen concurrently) or have already run. Additionally, for unique thread ids, we locally keep a set of may freed varinfos, that we check if the memory is also freed by the current thread. |
To me, this seems to be an instance of use-after-free instead of really being a race though? If both frees are protected by a mutex |
Indeed, but before we had any sort of multi-threaded use-after-free/double-free, this was the best we could do. It's not a data race, but it's a race condition.
Which MHP also does for races, so the same sort of checks are duplicated for these different things.
I guess this might be the extra bit of information that doesn't go into the access framework. Although I think it easily could as well.
It doesn't immediately fit indeed, but it should be possible to generalize a bit to make it fit. Precisely because use-after-free duplicates a lot of the logic already there for accesses in general: including iterating over all memory accesses at every expression and this MHP stuff. |
Closing as unneeded after all. The still-relevant discussion is delegated to #1351. |
We quickly looked at a random NoDataRace false positive from our SV-COMP 2023 results and saw hundreds of race warnings with just
free
accesses.Since
free
is thread-safe and the freed memory is not being even read, we could exclude them from our race check.