Skip to content
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

Explain why no overrides matched (Crucible LLVM) #414

Closed
langston-barrett opened this issue Apr 18, 2019 · 2 comments
Closed

Explain why no overrides matched (Crucible LLVM) #414

langston-barrett opened this issue Apr 18, 2019 · 2 comments
Assignees
Labels
topics: error-messages Issues involving the messages SAW produces on error
Milestone

Comments

@langston-barrett
Copy link
Contributor

When no override matches (after structural matching, for that case see #391), SAW prints

Symbolic execution failed.
Abort due to false assumption:
  no override specification applies for SHA256_Init
  in overrideBranches at /build/fizz-hkdf/main.saw:192:1

This isn't very informative! It would be much better to record and print the reasons that each override failed to apply and present this to the user.

@langston-barrett langston-barrett added the topics: error-messages Issues involving the messages SAW produces on error label Apr 18, 2019
@langston-barrett langston-barrett self-assigned this Apr 18, 2019
@langston-barrett
Copy link
Contributor Author

langston-barrett commented Apr 18, 2019

It seems that what's going on when the user sees

"no override specification applies for " ++ fnName

is that there are a collection of overrides, each of which has an attached Pred sym which summarizes its preconditions, and all of these Preds are evaluating to false.

The problem, then, is that a single Pred can't really provide meaningful information on why an override failed to match (e.g. which precondition failed to hold?). This is probably a good place to apply the techniques and datastructures introduced in GaloisInc/crucible#151, as they solve essentially the same problem as it arises during symbolic simulation.

@langston-barrett
Copy link
Contributor Author

Results from an offline conversation with @robdockins:

Observations

The way we end up selecting an override is by building up a somewhat complex continuation structure inside Crucible that symbolically branches on each precondition predicate, effectively trying each override's preconditions in order and selecting the first one that succeds. This information doesn't propagate back up to the SAW level, i.e. we don't learn which predicates succeeded or failed.

Now, we do have a list of conjoined, labeled predicates that make up the preconditions for each override. However, this isn't quite as helpful as it seems: an override's preconditions fail when the conjunction of the preconditions is false, which may not result from any individual conjuncts being false, but perhaps from an inconsistency among them.

Possible solutions

A first step which is both simple and generally useful (might improve performance) is to check if any overrides' preconditions are concretely false with asConstantPred. If all overrides failed to match, we can print out which conditions failed concretely.

A possible next step would be to narrow down why the conjoined symbolic predicates failed. The best tool for that job is likely the "unsatisfiable core" feature of some SMT solvers. However, this could be excessively detailed for the current problem.

A halfway point between the above options would be to go through the preconditions one at a time and use considerSatisfiability to determine if it is indeed a single conjunct that is failing. This is a kind of homespun version of computing certain unsatisfiable cores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topics: error-messages Issues involving the messages SAW produces on error
Projects
None yet
Development

No branches or pull requests

2 participants