Commit Graph

411 Commits

Author SHA1 Message Date
Tristan Ravitch
0eb0bd14f7 Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-04-25 08:41:41 -07:00
Joe Hendrix
655491bae3
Fix repo urls 2018-04-25 00:32:43 -07:00
Joe Hendrix
72b667a49c
Add crucible so we can build macaw-symbolic on travis. 2018-04-25 00:16:53 -07:00
Daniel Wagner
6453486013 delete some debugging print statements 2018-04-24 17:07:07 -04:00
Daniel Wagner
588e92cc01 add a few jump target formats 2018-04-24 17:05:17 -04:00
Daniel Wagner
0565805c4f more principled error reporting in readMemReprDyn 2018-04-24 14:52:38 -04:00
Daniel Wagner
3b3bcecc4a handle jump tables again, including PIC tables 2018-04-24 14:52:38 -04:00
Tristan Ravitch
bd686c3c2e Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-04-24 09:07:39 -07:00
Joe Hendrix
000c2f900e
Move macaw stack.yaml to root for similiarity with other Galois packages. 2018-04-24 09:05:36 -07:00
Joe Hendrix
6267122136
Add packages to stack.yaml 2018-04-24 08:25:13 -07:00
Joe Hendrix
9047cb41fb
Fix warnings in macaw-base; Fix errors in macaw-symbolic.
This also makes some changes to eliminate a couple redundent
type-class constraints in CrucGen.hs which propagated to other changes.
2018-04-24 01:17:03 -07:00
Tristan Ravitch
ee96681d8d Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-04-23 18:51:19 -07:00
Tristan Ravitch
8c20e0e156 Export another utility and type from Macaw.Memory
This type is needed to write some type signatures, and we needed an accessor to
extract segment ranges from a SegmentContents.
2018-04-23 18:50:39 -07:00
Joe Hendrix
9259a7e1f3
Update stack to reflect actual ghc version. 2018-04-23 11:57:24 -07:00
Joe Hendrix
4c290c2a33
Update to build with ghc 8.2.1 2018-04-23 11:56:01 -07:00
Joe Hendrix
052506f202
Remove PhaseHolderStmt. 2018-04-23 11:35:31 -07:00
Joe Hendrix
097edda1ef
Relocation support; various cleanups.
This patch adds initial support for relocations in Macaw code
discovery, and adds other refactoring.

* It introduces a SymbolValue constructor to represent references to
  symbols within Macaw.
* The various cases for x86 mov are made explicit after the flexdis refactor
  broke the previous code.  We should now support segment register movs and
  give better error messages when seeing mov with control or debug registers.
* The generic exception operation is replaced with Hlt and UD2 terminal
  x86-specific statements.
* CodeAddrReason is split into FunctionExploreReason and BlockExploreReason to
  clarify whether a function or block was discovered.
* The Macaw pretty printer is changed to use write_mem in place of pointer syntax.
* Various other refactoring is made to clarify code.
2018-04-23 11:24:21 -07:00
Joe Hendrix
0b8e95b0b0
Merge branch 'master' of github.com:GaloisInc/macaw 2018-04-17 16:02:28 -07:00
Brian Huffman
1e3fad7d77 Fix typo in module header description. 2018-04-16 10:07:23 -07:00
Tristan Ravitch
b2d955cb3e symbolic: export macawExtensions
This makes it easier (possible?) to call the simulator with a more custom setup
than is supported by runCodeBlock
2018-04-13 11:52:30 -07:00
Tristan Ravitch
9f93fd09c9 symbolic: Expose the constructor for MacawSimulatorState
This is needed to run the simulator
2018-04-13 09:06:03 -07:00
Tristan Ravitch
43688edef9 Fix a haddock parse error
Postfix haddock comments on GADT constructors (or constructor arguments) are not
yet supported.
2018-04-10 09:51:10 -07:00
Joe Hendrix
81e9c168af
Update submodules 2018-04-05 09:10:39 -07:00
Joe Hendrix
2feebceddc
Refactor relocation support; support .rel and some object symbols. 2018-04-05 09:06:12 -07:00
Tristan Ravitch
a229951066 symbolic: Re-export MacawExt to make it easier to use Data.Macaw.Symbolic 2018-04-02 14:20:43 -07:00
Tristan Ravitch
1517bf64b4 symbolic: Translate the macaw ArchState statement into crucible
This commit introduces a new syntax extension for the macaw translation to
represent the ArchState statement: MacawArchStateUpdate.

Also adds some new instances for MacawCrucibleValue.
2018-04-02 09:14:17 -07:00
Tristan Ravitch
4bd307e41d x86: Have the x86 backend emit the ArchState metadata statment
This statement will be used for architecture-independent analysis of macaw
(or possibly crucible) values in machine registers.
2018-03-30 10:35:47 -07:00
Tristan Ravitch
2524b77cb5 base: Change the type of the address in the ArchState statement
ArchMemAddr is easier to use than ArchAddrWord in downstream clients, and is
probably more faithful in the case where we want to support shared libraries
and/or object files.
2018-03-30 10:33:49 -07:00
Joe Hendrix
a258cf7b2b
Update submodule 2018-03-29 17:43:33 -07:00
Tristan Ravitch
ce96c55896 Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-03-29 17:09:05 -07:00
Tristan Ravitch
51b8dae802 Change the pretty printing of the 'ArchState' macaw statement 2018-03-29 17:08:40 -07:00
Joe Hendrix
9f49b7327a
Bump elf-edit 2018-03-29 16:40:26 -07:00
Joe Hendrix
265f61e206
Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-29 16:30:29 -07:00
Joe Hendrix
16d975d81f
Update submodules 2018-03-29 15:34:57 -07:00
Joe Hendrix
007405db1d
Improve robustness of elf loader, and start trying to parse relocations in objects. 2018-03-29 15:21:31 -07:00
Iavor Diatchki
8ac1a914ae Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-29 12:42:24 -07:00
Iavor Diatchki
81f327e037 Add a function to find all symbols, not just functions.
Joe is working on making this more generic in some way,
so this is just a quick (probably temporary) fix to expose
the needed functionality.
2018-03-29 12:42:18 -07:00
Jason Dagit
372d7d7208 Add a new macaw statement to record updates to machine registers
The new statement is called `ArchState`, and has two fields: an address and a
map.  The address is the address of the instruction it is standing in for.  The
map contains a mapping from the *machine registers* that the instruction updated
to the *macaw values* that were assigned to those locations.

This is useful metadata for debugging, but is also required to do some types of
architecture-independent analysis (where we can still reason about machine
register contents).
2018-03-29 09:53:08 -07:00
Tristan Ravitch
6152912518 x86: Improve the testing harness
The tests now check to make sure that no blocks end in a classification failure.
This exposed a problem where some simple cases (where the return address was
read from the stack) where we were getting classification failures.

It turns out that the problem was due to the code being PIE and loaded at a very
low address.  This made a number of small constants look like code pointers,
which threw off the abstract interpretation.

The fix is to load the test binaries at a large offset (0x400000 or so) to
reduce the likelihood of overlap.
2018-03-28 16:54:35 -07:00
Tristan Ravitch
cf07435434 Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-03-27 18:14:29 -07:00
Tristan Ravitch
8d5e39c87f base: Add additional simplification rules to the rewriter 2018-03-27 18:13:46 -07:00
Tristan Ravitch
c2c5835b10 base: Add another case to the abstract interpretation
Now handle shifts of constants
2018-03-27 18:13:23 -07:00
Iavor Diatchki
1a22cf0a90 Correct implementation of vpalignr 2018-03-27 15:28:46 -07:00
Iavor Diatchki
777fad441d Make it build with the Haskell2010 option 2018-03-27 11:01:18 -07:00
Iavor Diatchki
37c951722d Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-27 10:51:53 -07:00
Iavor Diatchki
0f3b97b8bf Definition for Unpack 2018-03-27 10:46:47 -07:00
Kevin Quick
594e9e025d
Restrict Semigroup imports to avoid collisions on unused definitions. 2018-03-27 10:43:04 -07:00
Kevin Quick
818f7a7767
Remove unused import in Macaw CFG Core. 2018-03-27 10:42:28 -07:00
Kevin Quick
789841f9fe
[x86] Constent use of language specification in cabal file.
Also updates the minimum cabal version.  This eliminates warnings
regarding this cabal file.
2018-03-27 10:41:18 -07:00
Kevin Quick
377c3d1a2b
Use architecture-specific identifyReturn in Discovery process.
Instead of inline analysis of whether the instruction pointer has been
updated to contain the ReturnAddr symbolic value, defer the
determination of the call return to the (previously defined but
unused) architecture-specific handling.  This allows architectures
like ARM that perform modifications on the values loaded to the
instruction pointer (e.g. clearing lower bits) to provide their own
recognition of a return operation.

Also modifies the signature of identifyReturn to return a Sequence of
statements to match the identifyCall type signature.

Replaces the previously unused identifyX86Return with the inline
detection of IP == ReturnAddr.
2018-03-27 10:35:55 -07:00