Commit Graph

383 Commits

Author SHA1 Message Date
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
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
Iavor Diatchki
f54f0a13ba Add some support for unpack; no symbolic implementation yet. 2018-03-26 18:51:19 -07:00
Iavor Diatchki
cb9cef128e Implement vpinsrq and structore for the rest of the vector insert instruction 2018-03-26 13:17:03 -07:00
Iavor Diatchki
789322f9c8 Call error explicitly, so that we know what needs implementing. 2018-03-23 17:44:41 -07:00
Joe Hendrix
ceefa7ae75
Update memory to use explicit BSS region and disable includeBSS option. 2018-03-23 16:26:07 -07:00
Iavor Diatchki
9ffaf478bf Semantics for vmovq 2018-03-23 16:15:43 -07:00
Iavor Diatchki
3736ce137a Remove some warnings. 2018-03-23 14:37:08 -07:00
Iavor Diatchki
f0d50049db Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-23 14:34:44 -07:00
Iavor Diatchki
2f070f99f0 Setup LLVM intrinsics, and make sure to use the config as the one for the sym. 2018-03-23 14:34:38 -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
Iavor Diatchki
79a4cdf39e Add support for forcing allocation of fresh bits (as opposed to pointer/bits) 2018-03-22 13:11:22 -07:00
Iavor Diatchki
cf34388d41 Don't validate pointer after alignment.
We validate only when using pointers.
2018-03-22 13:10:58 -07:00
Iavor Diatchki
d3d5f39ebb Change YMM patterns to just use Word8 directly.
Simpler, not clear that the additional abstraction was useful.
2018-03-21 16:14:59 -07:00
Iavor Diatchki
21ffae1ebe Prefix fresh names with macaw
Hopefully, this will avoid clashes with keywords.
2018-03-21 16:14:31 -07:00
Iavor Diatchki
36e6c8f7b9 Export GlobalMap 2018-03-20 19:56:52 -07:00
Iavor Diatchki
cec6f52e0f Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-20 19:04:05 -07:00
Iavor Diatchki
81aeca9e0b Generate a fresh value for a register. 2018-03-20 19:04:00 -07:00
Iavor Diatchki
20135c91ae Generate fresh symbolic values. 2018-03-20 19:03:50 -07:00
Joe Hendrix
77f518a9ab
Merge pull request #3 from robdockins/master
Minor update to track crucible API
2018-03-20 15:03:29 -07:00
Iavor Diatchki
4988297429 Change semantics for pointers!
When computing pointers we don't always check that the results are valid.
Instead, we do the check whenever we use the pointers.

The reason is to support code where pointers are temporarily "bad"
but are never used that way.  For example:


   subq $10, %aex   # aex contains a pointer
Loop:
   addq $10, %aex
   ...
2018-03-16 16:14:25 -07:00
Iavor Diatchki
1ea6792f28 Add special treatment for "aligning" pointers.
We don't really do anything with alignment, but sometime asm code
ands pointers to align them.  For example `andq $(-64), %rsp`
aligns the pointer to a multiple of 64.

To support code like this we treat "and"-ing a pointer with a special
constant of the form 0xFFFF...FF000  (i.e., and alignment) as a subtracting
`0x0000...00XXX`  where the `XXX` is symbolic.

This looses some information (i.e., we don't know that the result is aligned).
However, it is good enough for checking memory safety, as it covers
all possible results of the alignment.
2018-03-16 13:35:58 -07:00
Rob Dockins
4a4b9d7a8a Minor update to track crucible API 2018-03-15 17:21:42 -07:00
Iavor Diatchki
084f6a4d2b Merge branch 'master' of github.com:GaloisInc/macaw 2018-03-15 09:49:16 -07:00
Iavor Diatchki
6875f84971 Add implementation for vpsllq 2018-03-15 09:49:03 -07:00
Jason Dagit
e1ea0c8def Discovery: pretty instance for DiscoveryFunInfo now prints function address 2018-03-14 17:32:29 -07:00
Iavor Diatchki
f8dfc368c6 Allow reading from raw global addresses. 2018-03-14 17:20:22 -07:00
Iavor Diatchki
e967573eb0 Set false to False, not True :) 2018-03-14 15:22:19 -07:00
Iavor Diatchki
9c7070f8e6 Haddock comments fixes, thanks to Brian 2018-03-09 09:51:55 -08:00