Commit Graph

201 Commits

Author SHA1 Message Date
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
Samuel Breese
fb1611a127
Semantics for MULX from BMI2 and all of ADX 2019-12-19 10:43:54 -05:00
Joe Hendrix
1ed99917b4
Add testcase for non-zero index jumptable. 2019-12-04 14:31:45 -08:00
Joe Hendrix
df9b5bbe27
Support for offset jump tables. 2019-11-19 14:52:58 -08:00
Joe Hendrix
1be68af2a0
Fix warnings. 2019-10-21 21:18:54 -07:00
Joe Hendrix
81d0469fbe
Group mod/div x86 functions. 2019-10-21 14:59:43 -07:00
Joe Hendrix
744424d28b
Remove unused X86PrimLoc. 2019-09-20 15:19:37 -07:00
Joe Hendrix
5e834122d1
Segment register updates; stack offset calculation. 2019-09-20 13:58:05 -07:00
Joe Hendrix
7aee0cd803
Remove unused debug reg code. 2019-09-09 00:55:28 -07:00
Joe Hendrix
3dc9463b8d
Remove unused control register code. 2019-09-09 00:50:07 -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
0ad6ed8a85
Minor cleanup 2019-08-29 23:50:25 -07:00
Joe Hendrix
0767302c21
Add .gitignore for assembly files. 2019-08-27 16:42:08 -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
c2545b1bb1
Work-in-progres: Cleanups to discovery for jumpbounds improvements. 2019-08-23 01:11:52 -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
073e774a43
Introduce CValue; clarify function arguments fields.
This introduces a new datatype CValue for representing constants
in Macaw programs, modifies the existing Value datatype to use then,
and introduces patterns for compatibility with existing datatypes.

The patch also updates the function argument analysis to use more
explicit argument passing rather than monadic updates.  The intent is
to help clarify when data is initialized rather than updated.

Finally this updates a README and does some minor updates.
2019-08-06 09:37:41 -07:00
Joe Hendrix
06b0390cfd
Fix missing import in x86 2019-07-01 17:13:06 -07:00
Joe Hendrix
17c09c974f
Bump submodules; clarify stack offset abstract values 2019-07-01 16:35:47 -07:00
Joe Hendrix
ee6f1379ae
Additional cleanup to function args; bump versions.
This also provides some exports needed by Reopt.
2019-06-12 15:26:19 -07:00
Joe Hendrix
1607e83eef
Minor refactoring; improved branch abstract state propagation.
This primarily refines the abstract state propagated to branch
pairs.  It was needed on the ARM platform to support the IT blocks
with the changes to the Core representation in macaw-base 0.3.6.

This also includes a few simplifications added and comment
improvements.
2019-05-14 17:45:30 -07:00
Joe Hendrix
c6a7ba7cd6
Rename pblock fields to be more descriptive. 2019-04-29 22:21:10 -07:00
Joe Hendrix
327003ae56
Fix test case. 2019-04-29 22:04:21 -07:00
Joe Hendrix
3331a19571
Drop support for branches within blocks. 2019-04-28 13:19:20 -07:00
Joe Hendrix
2d12aea63b
Merge branch 'jhx/bump-submodules' into jhx/cond-write 2019-04-26 10:38:50 -07:00
Joe Hendrix
89f89e9ce6
This adds a conditional memory write to macaw. 2019-04-17 11:15:12 -07:00
Joe Hendrix
ec15debe20
Minor updates 2019-04-12 11:24:37 -07:00
Joe Hendrix
ef6951458a
Add pop tests. 2019-04-04 09:42:11 -07:00
Joe Hendrix
092cbc2e26
Minor fixes to tests 2019-04-03 16:44:00 -07:00
Joe Hendrix
3e763cc7a1
Add ret test 2019-04-03 16:43:42 -07:00
Joe Hendrix
74e8c6580e
Merge pull request #32 from GaloisInc/jhx/x86_tests
Add tests for btc/btr/bts
2019-04-03 13:59:50 -05:00
Joe Hendrix
036944d42e
Add btc/btr/bts tests 2019-04-03 08:24:57 -07:00
Joe Hendrix
a6149fa95f
Add x86-support to travis 2019-03-26 08:21:01 -07:00
Joe Hendrix
f1f16b7509
Remove warnings 2019-03-22 14:40:14 -07:00
Joe Hendrix
51333f4612
Deprecate outdated disassemble block functions. 2019-03-14 10:41:11 -07:00
Joe Hendrix
e8d2efcaae
Implement bitcast changes to macaw-symbolic 2019-02-26 17:53:34 -08:00
Joe Hendrix
c950affd65
Fix build errors made in previous commit. 2019-02-20 15:57:56 -08:00
Joe Hendrix
00096344a7
Support float/vector in reads/writes; Use floating point types. 2019-02-20 15:40:59 -08:00
Joe Hendrix
d3947f32b4
Support ZMM, bitcasting, and fixed length vectors. 2019-02-14 11:06:45 -08:00
Luke Maurer
cbda1717cc Fix for GHC versions < 8.8
`MonadFail` being a forward-compatibility measure, overriding
`Control.Monad.Fail.fail` in GHC versions <= 8.6 doesn't do anything
unless `Control.Monad.Fail.fail` is invoked explicitly (or the importing
module happens to have `-XMonadFailDesugaring` on).
2019-02-12 18:24:41 -08:00
Langston Barrett
274808a8ae update parameterized-utils submodule 2019-02-11 11:47:19 -08:00
Tristan Ravitch
05249a4632 Change some calls to fail into translation errors
These `getCallTarget` and `doJump` were calling `fail` if they saw an argument
type that we hadn't thought to handle yet.  This change turns those errors into
TranslationError statements, allowing macaw to continue exploring code.

This came up recently in a glibc-based example where macaw ended up exploring
unaligned code and creating a strange jump to a far pointer, which doesn't make
much sense in x86_64 mode.
2019-01-23 13:22:03 -08:00
Joe Hendrix
a5e3ba7247
Additional exports 2019-01-22 15:51:38 -05:00
Joe Hendrix
3eb92f34e1
Add x86_tests 2019-01-22 13:25:37 -05:00
Joe Hendrix
0eac4d6b49
Remove blockAddr; update dependencies 2019-01-22 05:07:52 -05:00
Tristan Ravitch
68c5578f03 symbolic: Translate the InstructionStart metadata statement into Crucible
Before, we just discarded them during the translation.  They are useful metadata
for generating diagnostics in Crucible, so this commit translates them.  They
are no-ops during symbolic evaluation.

To make them truly useful, they need to include the address of the block that
they belong to (their data payload in macaw is just an offset from the start of
a block).  This information wasn't available before, so it has to be plumbed
through in macaw-x86.
2019-01-10 22:23:39 -08:00
Kevin Quick
98807daee2
Added -Wcompat for warnings about future compatibility. 2019-01-10 13:43:27 -08:00
Joe Hendrix
ebc5d9575e
Merge remote-tracking branch 'public/master' into jhx/plt-support 2018-12-04 08:04:32 -08:00
Joe Hendrix
f03941d607
Add test-plt test case, and fix discovery to use trust symbols. 2018-12-04 00:04:23 -08:00