Commit Graph

289 Commits

Author SHA1 Message Date
Lisanna Dettwyler
47544e4b2d Fix warnings in GHC 8.10 2020-10-20 13:53:22 -07:00
Ben Selfridge
039b8497fc
updates what4, crucible, etc. (#146)
* update to bv-sized branch of what4 and other things

* removed parameterized-utils submodule completely

* Updates submodules

* Fixes macaw-symbolic w.r.t. crucible-llvm changes

Co-authored-by: Ben Selfridge <ben@000548-benselfridge.local>
2020-06-16 16:49:55 -07:00
Sam Breese
02c6cc3cb5
Handle bitwise operations on stack offset abstract values (#136)
- Generalize handling of bitwise operations to also apply them to stack offsets
- Use the extended bitwise handling on AND
2020-05-28 14:04:06 -04:00
Ben Selfridge
76868cf457
Fixed buggy rewrite rules involving testBit/shifts (#132)
* Fixed buggy rewrite rule involving testBit/shifts
2020-05-05 15:45:36 -07:00
Tristan Ravitch
e536e43f1b Introduce macaw-aarch32 and macaw-aarch32-symbolic
These packages replace the old macaw-arm (which has been removed).  The only
change to the core macaw is to introduce a `Lift` instance for the Endianness
data type, which is used in macaw-semmc.

The macaw-aarch32 package uses the official ARM semantics (via the
asl-translator package).  In its current state, macaw-aarch32 seems to handle
the common idioms of simple ARM binaries.  Position independent executables have
not been tested yet.  The semantics and disassemblers for Thumb are present, but
not integrated into code discovery at this time.  There are some tests in
macaw-aarch32.  Compile times are longer than necessarily desired.
macaw-aarch32 can be compiled in two modes: lite mode (cabal flag -fasl-lite),
which uses a restricted set of instructions for testing, and takes less time to
compile.  The full instruction set is the default, though there are a few
undefined functions that are not yet handled for the full set, mostly relating
to floating point operations.

The macaw-aarch32-symbolic package is currently a stub, but is implemented to
provide a few necessary instances.
2020-04-12 19:53:00 -07:00
Tristan Ravitch
958aeaa3ed Remove the nested mux match rule from macaw core
We can now do enough rewriting in the ARM backend that it isn't needed.  This
adds extra ARM rewriting rules and a term cache to make matching easier.
2020-04-08 19:46:32 -07:00
Daniel Matichuk
77e721ac0e add support for redundant nested muxes 2020-04-04 22:24:47 -07:00
Daniel Matichuk
5dab9c5209 Merge remote-tracking branch 'origin/master' into feature/asl 2020-04-03 23:38:19 -07:00
Ben Selfridge
8afc18dc62 feature/asl: BROKEN BUILD -- updated asl-translator, need to fix 2020-04-03 18:33:31 -07:00
Joe Hendrix
14da5837a6 Remove spurious warnings from function args. 2020-03-25 23:20:53 -07:00
Joe Hendrix
2f93b70946 Fix register-use; add null terminated string reader to Memory. 2020-03-20 18:22:48 -07:00
Tristan Ravitch
e024646860
macaw-refinement (#114)
This commit updates macaw-refinement to work with the latest macaw/crucible and makes a few improvements along the way.

The major changes involved in this are:
* Block labels were removed from macaw, so we had to come up with an alternative approach to making synthetic blocks to represent dispatch resolved by macaw-refinement that is not really a jump table. We considered adding a new terminator that encoded "computed IP-based dispatch", but there was concern about the impact on client code. Instead, we added a field to the `DiscoveryFunInfo` that records "external" resolutions to indirect control flow (e.g., as by an SMT solver in macaw-refinement). The hook by which we feed SMT-based resolutions back into macaw was modified accordingly (`addDiscoveredFunctionBlockTargets`).
* Solver invocation changed to allow solver selection and parallel solver application.
* Logging is now done via the `lumberjack` library.
* macaw-symbolic now uses the "external" resolutions in `DiscoveryFunInfo` while building crucible CFGs.
* The path creation code in macaw-refinement was simplified significantly and the approach to path creation has been documented.
* The run-refinement tool is now more featureful.
* The test suite is a bit more structured and no longer depends on the printed output of the discovery process.
2020-03-12 17:15:08 -07:00
Ben Selfridge
deb6d2b161 feature/asl: lifted endianness out of macaw-semmc TH 2020-03-09 16:07:07 -07:00
Tristan Ravitch
c825332f39
Update/ghc 8.8 (#112)
Updates for GHC 8.8

The two main classes of update are related to MonadFail and type alias expansion.

The MonadFail updates introduce explicit MonadFail instances and backward-compatible `fail` implementations under `Monad` for older GHC versions.

The type alias expansion rules changed in GHC 8.8 in a way that breaks the `Simple Lens` idiom; instead, we have to use `Lens'`.  Lens started supporting this alias in version 3.8, which was released in 2013.

This change includes necessary submodule updates, as well as the update for the split of what4 into its own repository.
2020-03-03 13:28:26 -08:00
Joe Hendrix
54a9f93431 Remove invariant type from registeruse 2020-02-07 00:19:19 -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
Tristan Ravitch
c1d4155f3d
Merge branch 'master' into tr/block-classifier-context-type 2019-12-06 10:56:44 -08:00
Joe Hendrix
145bca4591
Add reopt dependency analysis to macaw. 2019-12-04 15:23:44 -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
Joe Hendrix
df9b5bbe27
Support for offset jump tables. 2019-11-19 14:52:58 -08:00
Tristan Ravitch
1c5abc6728 Documentation updates in macaw-base 2019-11-12 17:27:14 -08:00
Joe Hendrix
1cc36b4d0c
Propagate correct stack value after call. 2019-10-28 13:49:00 -07:00
Joe Hendrix
cf8c33398e
Additional exports; bounds pretty printing. 2019-10-28 13:47:59 -07:00
Joe Hendrix
81d0469fbe
Group mod/div x86 functions. 2019-10-21 14:59:43 -07:00
Joe Hendrix
d5a51ff9c3
Cleanups to jump bounds. 2019-10-17 23:33:57 -07:00
Joe Hendrix
26f29f3005
Generalizations to support reopt. 2019-10-16 13:57:19 -07:00
Joe Hendrix
d16f2b2ea0
Remove spurius calls to error in AbsState bvsbb. 2019-10-02 12:32:42 -07:00
Kevin Quick
4536e9d33e
[base] Fix GHC 8.4.4 haddock 2019-10-01 14:09:18 -07:00
Joe Hendrix
5e834122d1
Segment register updates; stack offset calculation. 2019-09-20 13:58:05 -07:00
Joe Hendrix
94549ef6cb
Update minor version for precondition addition. 2019-09-04 23:29:14 -07:00
Joe Hendrix
df95e65987
Various changes to support VCG.
The changes include:

  Clean up elf loading to fix a bug in rel addend parsing.

  Introduce block preconditions for populating reopt-vcg fields.

  Change load options to match reopt's interface.
2019-09-04 23:21:23 -07:00
Joe Hendrix
28e3624ca6
Bump parameterized-utils version 2019-08-30 00:02:23 -07:00
Joe Hendrix
5a8d7d5f07
Update cached fold to use CValue constructor. 2019-08-29 23:50:25 -07:00
Kevin Quick
a2af885b67
Cannot haddock tuple fields, so use pre-type haddock over entire tuple.
This is less satisfying because it separates the documentation from
the fields, but it seems to be necessary for haddock to work.
2019-08-28 10:07:13 -07:00
Kevin Quick
8f32297a35
Haddock works better with constructor pre-documentation.
I believe this is due to an ambiguity of whether the
post-documentation reference is to the previous constructor or just
the last argument of the previous constructor.  By moving the haddocks
to be a pre-doc this seems to work better.
2019-08-28 09:59:15 -07:00
Kevin Quick
bc9d5433ee
Haddock requires indentation to match the constructor argument. 2019-08-28 09:58:35 -07:00
Kevin Quick
f342c9d000
Haddock cannot document constructor fields with strictness annotations.
It also cannot handle the UNPACK pragma, which could probably be
removed since -funbox-small-strict-fields is on by default, but
haddock would still fail for the strictness annotation.

By moving the haddocks to the constructor instead of the individual
fields the strictness restriction can be avoided.
2019-08-28 09:56:01 -07:00
Joe Hendrix
433df7399e
Additional Hashable instances for Macaw/hashtable compatibility. 2019-08-27 16:40:16 -07:00
Joe Hendrix
821d434370
Add support for equalities in jump table bounds. 2019-08-27 16:39:41 -07:00
Joe Hendrix
8376ecbed6
Fix warnings. 2019-08-23 09:57:54 -07:00
Joe Hendrix
c2545b1bb1
Work-in-progres: Cleanups to discovery for jumpbounds improvements. 2019-08-23 01:11:52 -07:00
Joe Hendrix
b1c6fb8b77
Fix parameterized-utils dependency 2019-08-21 23:59:22 -07:00
Joe Hendrix
494aff6ff0
This makes a number of changes to abstract domains.
The goal is to support a jumptable testcase that is not supported by
the current jump bounds check.  The jump bounds check needs to be
augmented so that it understands equality relationships between stack
values and registers, and bounds on both.

This patch tracks when a register points to a concrete stack offset.

As part of this, we droped the AbsDomain instance for AbsBlockState.
Clients should now likely use `fnStartAbsBlockState` in lieu of `top`.

The other client visible change is that the ClassifyFailure
constructor now has an extra argument with details about why
classification failure occured.
2019-08-21 23:29:16 -07:00
Joe Hendrix
e8c4d39840
Introduce MemInt 2019-08-21 23:17:18 -07:00
Kevin Quick
84a14372cd
Fix parse error for haddock. 2019-08-12 22:11:25 -07:00
Joe Hendrix
f03fdce04b
Remove other unpack 2019-08-12 12:51:09 -07:00