Commit Graph

109 Commits

Author SHA1 Message Date
Daniel Wagner
024e393e8e more rewrite rules for <= and < 2018-05-30 15:50:16 -04:00
Daniel Wagner
38aeecba21 add/improve rewrite rules for testing bits of shifted values 2018-05-30 15:50:16 -04:00
Daniel Wagner
917f921301 make JumpBounds abstract interpretation more precise 2018-05-30 15:50:16 -04:00
Daniel Wagner
d0566fe03b lay some groundwork for jump table detection on PPC 2018-05-30 15:50:16 -04:00
Daniel Wagner
3814d9c649 documentation fix 2018-05-30 15:50:16 -04:00
Daniel Wagner
5c9707508c rewrite away saturated shifts 2018-05-30 15:50:16 -04:00
Daniel Wagner
fa96a062e1 adding two finsets, get a finset 2018-05-30 15:50:16 -04:00
Ben Selfridge
0dddfcacea fixed haddock parse errors 2018-05-10 16:48:18 -07:00
Tristan Ravitch
0eb0bd14f7 Merge branch 'master' of github.com:GaloisInc/macaw into HEAD 2018-04-25 08:41:41 -07:00
Daniel Wagner
6453486013 delete some debugging print statements 2018-04-24 17:07:07 -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
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
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
Joe Hendrix
2feebceddc
Refactor relocation support; support .rel and some object symbols. 2018-04-05 09:06:12 -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
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
265f61e206
Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-29 16:30:29 -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
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
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
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
Joe Hendrix
ceefa7ae75
Update memory to use explicit BSS region and disable includeBSS option. 2018-03-23 16:26:07 -07:00
Joe Hendrix
557408132c
Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-23 14:13:09 -07:00
Aaron Tomb
e33ecf3e84 Fix build with GHC 8.4.1 2018-03-23 14:09:28 -07:00
Jason Dagit
e1ea0c8def Discovery: pretty instance for DiscoveryFunInfo now prints function address 2018-03-14 17:32:29 -07:00
Ben Davis
9b592c3285
Add exploreFnPred to DiscoveryState to optionally filter exploration 2018-03-02 08:39:49 -05:00
Kevin Quick
601b9def8c Merge branch 'master' of https://github.com/GaloisInc/macaw 2018-03-01 11:00:14 -08:00
Kevin Quick
e35acdcb19
Minor comment fixup. 2018-03-01 10:59:11 -08:00
Kevin Quick
84eb0a0a80 Revert "Add BVUrem App support."
This reverts commit 6a0a59e298.

Do not want to add BVUrem because divide by zero can cause an
exception and this will greatly increase the complexity for analysis.
2018-03-01 10:57:28 -08:00
Iavor Diatchki
da2a29b595 :Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-01 10:00:41 -08:00
Iavor Diatchki
c69349e957 Add support for global memory regions. 2018-03-01 10:00:32 -08:00
Joe Hendrix
14ab6352f5
Export elfAddrWidth 2018-02-28 09:26:10 -08:00
Iavor Diatchki
2e21856afe Merge remote-tracking branch 'origin/master' into mem-model
# Conflicts:
#	base/src/Data/Macaw/Memory/ElfLoader.hs
2018-02-27 16:36:08 -08:00
Joe Hendrix
9c8d7921f8
Merge branch 'master' of github.com:GaloisInc/macaw 2018-02-26 13:18:15 -08:00
Joe Hendrix
027c355001
Remove reloc hack 2018-02-26 13:04:01 -08:00
Kevin Quick
6a0a59e298
Add BVUrem App support. 2018-02-21 20:39:57 -08:00
Joe Hendrix
cc2d09a07d
Use type synonym to clarify argument for including BSS. 2018-02-20 16:37:26 -08:00