symbolic
: Improve the semantics of pointer comparisons
#392
Labels
symbolic-execution
Issues relating to macaw-symbolic and symbolic execution
Consider
doPtrLt
:macaw/symbolic/src/Data/Macaw/Symbolic/MemOps.hs
Lines 858 to 870 in 6457541
First of all, there's some redundancy here:
andPred sym okP1 okP2
is strictly stronger thanboth_ptrs
, which it isand
ed with.More concerningly, this function invents a fresh predicate (via
mkUndefinedBool
) that encodes the result of the comparison in the case that they aren't pointers to the same allocation. This means that multiple calls todoPtrLt
with the same pointers return uncorrelated fresh predicates, so that the following pseudo-code program could report an assertion failure, even though the assertion should be unreachable:(I haven't tested this, but it should be easy to develop such a test case when we have a CLI #390).
doPtrLeq
suffers from the same problem.It's not clear if there's really a great solution here. In the ideal world, Macaw would explore all and only the feasible executions of a program, but for these operations it appears that there's a trade-off:
Perhaps it's worth exposing more knobs with which to tune Macaw's behavior, as appropriate for downstream clients? For clients doing verification, this more permissive behavior might be fine: if you can prove the verification conditions for all the feasible executions plus some infeasible ones, you've still proved them for the feasible ones. However, for bug-hunting, we might might care less about missing some feasible paths, prefering fewer false positives (reports of possible bugs that cannot occur in real executions).
The text was updated successfully, but these errors were encountered: