Commit Graph

1567 Commits

Author SHA1 Message Date
Daniel Matichuk
3d4ff4b6a5 update test script to use asl-lite 2020-03-10 21:39:42 -07:00
Daniel Matichuk
11416e2c65 bump submodules 2020-03-10 21:39:42 -07:00
Ben Selfridge
06482d29e9 feature/asl: Now compiles, no semantics yet 2020-03-09 15:26:28 -07:00
Ben Selfridge
14ee2a7f70 feature/asl: update parameterized-utils 2020-03-09 15:23:32 -07:00
Ben Selfridge
6cbf12623a feature/asl: Eval compiles, probably incomplete 2020-03-04 11:07:45 -08:00
Ben Selfridge
77486004a3 feature/asl: Arch.hs compiles, but we probably need to add stuff to it 2020-02-28 12:17:43 -08:00
Ben Selfridge
c8c918128b feature/asl: finished locToRegTH in ARMReg 2020-02-28 12:17:22 -08:00
Ben Selfridge
4d4d067245 feature/asl: updated ARMReg to new ASL types. Still need to write
locToRegTH function.
2020-02-27 17:59:33 -08:00
Ben Selfridge
f883ebb583 feature/asl: renamed cabal file 2020-02-27 17:59:16 -08:00
Daniel Matichuk
8a4dc3f10a bump submodules 2020-02-27 13:34:27 -08:00
Daniel Matichuk
5970878919 add yices to travis dependency 2020-02-26 23:49:27 -08:00
Daniel Matichuk
80fb37c0fb submodules -> deps 2020-02-26 23:46:50 -08:00
Daniel Matichuk
4f97f5afad add testing script 2020-02-26 23:43:09 -08:00
Daniel Matichuk
cab27e1bd0 add simple travis build for macaw-asl 2020-02-26 23:22:54 -08:00
Daniel Matichuk
a98dec23c0 bump submodules 2020-02-26 23:05:08 -08:00
Daniel Matichuk
ad10d389fb copy macaw-arm into macaw-asl 2020-02-24 15:39:41 -08:00
Joe Hendrix
9a1a139338
Merge pull request #109 from GaloisInc/jhx/develop
Macaw updates for Reopt register usage analysis.
2020-02-21 15:02:40 -08:00
Joe Hendrix
e976b8aa3d
Merge branch 'master' into jhx/develop 2020-02-20 10:24:13 -08:00
Andrew Kent
25e80c9d13
bump dismantle submodule 2020-02-19 10:55:09 -08:00
Tristan Ravitch
1f7c7668ff
Merge pull request #107 from GaloisInc/tr/rewrite-symbolic-memory-model
Tr/rewrite symbolic memory model
2020-02-11 14:43:14 -08:00
Tristan Ravitch
80125921a9 This commit re-implements the memory model used by macaw symbolic
There are two major changes:
- The interface to memory models in Data.Macaw.Symbolic has changed
- The suggested implementation in Data.Macaw.Symbolic.Memory has changed

The change improves performance and fixes a soundness bug.

* `macawExtensions` (Data.Macaw.Symbolic) takes a new argument: a `MkGlobalPointerValidityPred`.  Use `mkGlobalPointerValidityPred` to provide one.
* `mapRegionPointers` no longer takes a default pointer argument (delete it at call sites)
* `GlobalMap` returns an `LLVMPtr sym w` instead of a `Maybe (LLVMPtr sym w)`

Users of the suggested memory model do not need to worry about the last change,
as it has been migrated.  If you provided your own address mapping function, it
must now be total.  This is annoying, but the old API was unsound because
macaw-symbolic did not have enough information to correctly handle the `Nothing`
case.  The idea of the change is that the mapping function should translate any
concrete pointers as appropriate, while symbolic pointers should generate a mux
over all possible allocations.  Unfortunately, macaw-symbolic does not have
enough information to generate the mux itself, as there may be allocations
created externally.

This interface and implementation is concerned with handling pointers to static
memory in a binary.  These are distinguished from pointers to
dynamically-allocated or stack memory because many machine code instructions
compute bitvectors and treat them as pointers.  In the LLVM memory model used by
macaw-symbolic, each memory allocation has a block identifier (a natural
number).  The stack and each heap allocation get unique block identifiers.
However, pointers to static memory have no block identifier and must be mapped
to a block in order to fit into the LLVM memory model.

The previous implementation assigned each mapped memory segment in a binary to
its own LLVM memory allocation.  This had the nice property of implicitly
proving that no memory access was touching unmapped memory.  Unfortunately, it
was especially inefficient in the presence of symbolic reads and writes, as it
generated mux trees over all possible allocations and significantly slowed
symbolic execution.

The new memory model implementation (in Data.Macaw.Symbolic.Memory) instead uses
a single allocation for all static allocations.  This pushes more of the logic
for resolving reads and writes into the SMT solver and the theory of arrays.  In
cases where sufficient constraints exist in path conditions, this means that we
can support symbolic reads and writes.  Additionally, since we have only a
single SMT array backing all allocations, mapping bitvectors to LLVM pointers in
the memory model is trivial: we just change their block identifier from zero
(denoting a bitvector) to the block identifier of the unique allocation backing
static data.

This change has to do some extra work to ensure safety (especially that unmapped
memory is never written to or read from).  This is handled with the
MkGlobalPointerValidityPred interface in Data.Macaw.Symbolic.  This function,
which is passed to the macaw-symbolic initialization, constructs well-formedness
predicates for all pointers used to access memory.  Symbolic execution tasks
that do not need to enforce this property can simply provide a function that
never returns any predicates to check.  Implementations that want a reasonable
default can use the mkGlobalPointerValidityPred from Data.Macaw.Symbolic.Memory.
The default implementation ensures that no reads or writes touch unmapped memory
and that writes to static data never write to read-only segments.

This change also converts the examples in macaw-symbolic haddocks to use doctest
to ensure that they do not get out of date.  These are checked as part of CI.
2020-02-11 09:58:53 -08:00
Joe Hendrix
54a9f93431 Remove invariant type from registeruse 2020-02-07 00:19:19 -08:00
Joe Hendrix
637a6e5cf0
Merge pull request #108 from GaloisInc/jhx/registeruse
Update register usage for reopt
2020-02-06 21:45:35 -08:00
Joe Hendrix
d7548aeaf1 Add base-orphans GHC 8.4 dependency. 2020-02-06 21:02:25 -08:00
Joe Hendrix
f87fb909e7 Update to latest stackage LTS. 2020-02-06 19:44:42 -08:00
Joe Hendrix
5925c4f68f Code cleanups 2020-02-06 19:26:46 -08:00
Joe Hendrix
00303e8f40 Fix warnings; code cleanups. 2020-02-06 19:26:46 -08:00
Joe Hendrix
46be7aa52b Implement new registerUse analysis.
The new registerUse analysis uses a three phase process:

Phase 1 computes invariants about the start state of each block.  It
will indicate when registers/stack locations store stack offsets, and
where callee saved registers are stashed.  It also memoizes
information about stack reads and writes to simplify later passes.

Phase 2 is a demand analysis that computes which registers and stack
locations must be available to execute the program.  It then
propagates those constraints across blocks in the function.

Phase 3 combines the information into a form relevant for function
recovery.
2020-02-06 19:26:46 -08:00
Joe Hendrix
9433737292 Bump macaw base version 2020-02-06 19:16:23 -08:00
Joe Hendrix
0236aa5d9a Introduce separate stack-analysis algorithm. 2020-02-06 19:16:23 -08:00
Sam Breese
a52698beae
Merge pull request #103 from GaloisInc/bmi2
Semantics for MULX from BMI2 and all of ADX
2020-02-03 16:13:26 -05:00
Andrei Stefanescu
16f80bde82
Merge branch 'master' into bmi2 2020-02-03 09:58:21 -08:00
Tristan Ravitch
e3aaf47a50
Tr/update submodules (#105)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-25 12:25:38 -08:00
Tristan Ravitch
d119a9ed5a
Update submodules (#104)
The main change here is in macaw-semmc to account for a change to the BVOrBits
operation in Crucible.
2020-01-17 16:17:30 -08:00
Tristan Ravitch
312274e2f3
Merge pull request #101 from GaloisInc/tr/update-crucible-dec19
Update the crucible submodule
2019-12-19 16:21:34 -08:00
Tristan Ravitch
6b490a8193 Update the crucible submodule
The only real code change required is that simulation failure messages have an
extra argument.  The goal with this update is to pull in some fixes to the
solver feature detection for yices in the latest crucible.
2019-12-19 15:03:09 -08:00
Samuel Breese
fb1611a127
Semantics for MULX from BMI2 and all of ADX 2019-12-19 10:43:54 -05:00
Tristan Ravitch
a744ca7a95
Merge pull request #95 from GaloisInc/tr/block-classifier-context-type
Change the BlockClassifierContext in Discovery into a datatype (from …
2019-12-06 11:23:26 -08:00
Tristan Ravitch
c1d4155f3d
Merge branch 'master' into tr/block-classifier-context-type 2019-12-06 10:56:44 -08:00
Joe Hendrix
95c2a3026e
Merge pull request #97 from GaloisInc/jhx/dependency
This adds dependency analysis from Reopt to macaw
2019-12-04 15:59:30 -08:00
Joe Hendrix
145bca4591
Add reopt dependency analysis to macaw. 2019-12-04 15:23:44 -08:00
Joe Hendrix
4f30c21c29
Merge pull request #89 from GaloisInc/jhx/jumptest
Add testcase for non-zero index jumptable.
2019-12-04 15:22:24 -08:00
Joe Hendrix
1ed99917b4
Add testcase for non-zero index jumptable. 2019-12-04 14:31:45 -08:00
Tristan Ravitch
a21db268de
Merge pull request #96 from GaloisInc/tr/crucible-string-macaw-semmc
Update macaw-semmc to work with crucible changes
2019-12-03 10:17:18 -08:00
Tristan Ravitch
62eb2deb1f Update macaw-semmc to work with crucible changes
The improved string support in Crucible adds a parameter to string reprs; this
change accommodates that.  Earlier changes added the necessary support in the
rest of macaw.
2019-12-02 18:42:46 -08:00
Tristan Ravitch
4f56645ac8
Merge pull request #93 from GaloisInc/rwd/strings2
Update macaw-symbolic with changes to string literals in what4
2019-12-02 17:27:08 -08:00
Tristan Ravitch
5509548372 Change the BlockClassifierContext in Discovery into a datatype (from a tuple)
I'm about to add a new field, and the 7-tuple was a bit confusing.
2019-11-27 11:57:13 -08:00
Rob Dockins
d068667ed8 Merge branch 'master' into rwd/strings2 2019-11-23 18:53:37 -08:00
Tristan Ravitch
b44e8c480f Update the semmc submodule
This brings it up to master.  The submodule has some improvements to synthesis,
but they changed some APIs.
2019-11-21 20:42:05 -08:00
Tristan Ravitch
9e9eb1b770 Fix macaw-ppc compilation
Fixes #80, which removed a type parameter from `IntraJumpBounds`
2019-11-19 17:28:40 -08:00