Fix unsound query in path-sensitivity functor #155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While thinking about #148 (which has an experimental fix in the
thread/path-sensbranch) and comparing the mechanism with normal function call mechanism, I discovered the following unsoundness bug.If different elements of the path-sensitive set (e.g. made path-sensitive by different mutex sets) have different points-to sets for a function pointer address, then these were previously combined with
meetinPathSensitive2whenFromSpecuses the query from outside to determine possible functions:analyzer/src/framework/constraints.ml
Lines 676 to 679 in e2a0555
So the intersection became empty and no functions were called at all! The right thing to do would be to join queries over all paths instead because paths are disjunct unlike multiple analyses which are conjunct.
This obviously isn't as precise as it could be because it forgets which functions may get called from which paths but there's no easy way around that right now. This is due to all the logic being on the top level at
FromSpecinstead of being somehow withinPathSensitive2where each path could evaluate the function variable separately and handle them only along that path. But that's another story altogether...