Commit Graph

27 Commits

Author SHA1 Message Date
Ryan Scott
97c61e471a Add basic support for simulating PLT stubs and shared libraries
This extends `Data.Macaw.Symbolic.Testing` in `macaw-symbolic` to be able to
handle binaries that depend on shared libraries. This is fully functional for
the x86-64 and AArch32 symbolic backends, and I have added test cases to the
respective repos demonstrating that it works. (The PowerPC backend is not yet
supported. At a minimum, this is blocked on GaloisInc/elf-edit#35.)

To implement this, I also needed to add some additional infrastructure to
`macaw-base` (I put this infrastructure here as it doesn't depend on any
Crucible-specific functionality):

* `Data.Macaw.Memory.ElfLoader.DynamicDependencies`: a basic ELF dynamic
  loader that performs a breadth-first search over all `DT_NEEDED` entries
  that an ELF binary depends on (both directly and indirectly).
* `Data.Macaw.Memory.ElfLoader.PLTStubs`: a collection of heuristics for
  detecting the addresses of PLT stubs in a dynamically linked binary.

It is worth noting that shared libraries are rife with nuance and subtlety,
and the way `macaw` models shared libraries is not 100% accurate. I have
written a length `Note [Shared libraries]` in `Data.Macaw.Symbolic.Testing`
to describe where corners had to be cut.

Fixes #318.
2023-02-23 17:16:12 -05:00
Tristan Ravitch
857bb72b31 [x86] Add an option to save macaw IR from test cases 2022-06-27 15:02:43 -07:00
Ryan Scott
ce10bc9243 Drop support for GHC 8.6
This allows us to remove gobs of CPP as a consequence.
2022-01-10 16:40:23 -05:00
Joe Hendrix
cdc90bd846 Update to more recent flexdis 2021-06-14 13:22:46 -07:00
Sam Breese
8a0c760886
x86: Add semantics for SHA256 instructions (#196)
* Add semantics for SHA256 instructions

* Use an additional helper function

* Address comments
2021-03-30 18:32:35 -04:00
Brian Huffman
2a620d41de Switch from ansi-wl-pprint to the prettyprinter package.
This patch relies on the following submodule updates:
- GaloisInc/what4#77
- GaloisInc/elf-edit#20
- GaloisInc/crucible#586
- GaloisInc/asl-translator#28

This patch updates the following packages:
- macaw-base
- macaw-symbolic
- macaw-x86
- macaw-x86-symbolic
- macaw-aarch32
- macaw-ppc
- macaw-semmc
- macaw-refinement
2020-12-02 11:38:19 -08:00
Sam Breese
34e7394c14
x86: Implement semantics for a few instructions (#167)
* x86: Add aesenc, aesenclast, aesdec, aesdeclast

* x86: Add vpcmpgtd

* WIP

* Implement Pshufb

* Fix AESNI_AESEncLast.

* Fix PtCmpGt.

* Refactor AESNI instructions a bit

* Finish refactoring

* Forgot MultiWayIf

* Reduce duplication a bit

* Address comments

Co-authored-by: Andrei Stefanescu <andrei@stefanescu.io>
2020-10-08 19:37:17 -04:00
Samuel Breese
fb1611a127
Semantics for MULX from BMI2 and all of ADX 2019-12-19 10:43:54 -05:00
Joe Hendrix
81d0469fbe
Group mod/div x86 functions. 2019-10-21 14:59:43 -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
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
Kevin Quick
1d7cdc87eb
Implement NoStarIsType and MonadFail for GHC 8.6. 2018-11-21 00:08:33 +00:00
Joe Hendrix
bb63f9f859
This fixes tail call detection, and allows architecture-specific checks. 2018-11-12 11:56:44 -05:00
Joe Hendrix
c886c19b03
Rename Memory exports.
This update renames many of the declarations exported by
Data.Macaw.Memory so that we have more consistent names.

The majority of the existing names are now exported with DEPRECATION
warnings.  Some of the symbol declarations that were not used by the
Memory datatype have been moved to other modules.

The minor version of macaw-base has been incremented.
2018-10-18 10:07:20 -07:00
Joe Hendrix
230b318dcf
Updates to discovery 2018-08-14 23:29:02 -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
Joe Hendrix
278b079a49
Fix warnings; remove -Werror 2018-01-21 07:56:04 -08:00
Joe Hendrix
79b5606e3c
Merge remote-tracking branch 'origin/avx' 2018-01-16 15:38:14 -08:00
Joe Hendrix
48001ea6f1
Add updated flexdis constraints. 2018-01-16 15:37:30 -08:00
Iavor Diatchki
1f2e80f1a5 Implement a couple of instructions 2017-12-18 16:53:27 -08:00
Joe Hendrix
478e7db31a
Refactor X86 semantics types; add tuples to Macaw. 2017-12-01 13:58:20 -08:00
Joe Hendrix
2bd710b49d
Move global function argument analysis to Macaw; Syscall changes
We also moved the syscall interface to be X86 specific to be compat
with earlier changes.
2017-11-22 14:07:55 -08:00
Ben Selfridge
afeb8f77c9 New Travis script 2017-11-08 12:05:28 -08:00
Ben Selfridge
580cb634cd Fixed macaw-x86 test suite, all tests seem to pass fine. 2017-11-01 15:56:54 -07:00
Joe Hendrix
7c33bf82e4
Update license information. 2017-09-27 15:59:06 -07:00
Joe Hendrix
4dcb26ebee
Add x86 specific code. 2017-09-27 15:54:43 -07:00