Commit Graph

2109 Commits

Author SHA1 Message Date
Langston Barrett
83d3907054 Use Crucible goal-proving helpers in testing code 2024-07-16 15:30:35 -04:00
Ryan Scott
2c15fcc6ed Cite Macaw paper and blog post in the README
Fixes #343. Fixes #397.
2024-07-16 13:17:44 -04:00
Ryan Scott
a6ff58f473 macaw-x86-symbolic: Fix idiv/div semantics
When converting a Macaw value with the Macaw type `TupleType [x_1, ..., x_n]`
to Crucible, the resulting Crucible value will have the Crucible type
`StructType (EmptyCtx ::> ToCrucibleType x_n ::> ... ::> ToCrucibleType x_1)`.
(See `macawListToCrucible(M)` in `Data.Macaw.Symbolic.PersistentState` for
where this is implemented.) Note that the order of the tuple's fields is
reversed in the process of converting it to a Crucible struct. This is a
convention that one must keep in mind when dealing with Macaw tuples at the
Crucible level.

As it turns out, the part of `macaw-x86-symbolic` reponsible for interpreting
the semantics of the `idiv` instruction (for signed quotient/remainder) and the
`div` instruction (for unsigned quotient/remainder) were _not_ respecting this
convention. This is because the `macaw-x86-symbolic` semantics were returning a
Crucible struct consisting of `Empty :> quotient :> remainder)`, but at the
Macaw level, this was interpreted as the tuple `(remainder, quotient)`, which
is the opposite of the intended order. This led to subtle bugs such as those
observed in #393.

The solution is straightforward: have the `macaw-x86-symbolic` semantics
compute `Empty :> remainder :> quotient` instead. Somewhat counterintuitive,
but it does work.

Fixes #393.
2024-07-12 16:56:51 -04:00
Ryan Scott
645754178a CI: Regenerate freeze files using latest GHC minor versions 2024-06-13 04:25:12 -04:00
Ryan Scott
4db0341e0a Bump submodules to allow building with what4-1.6.*
This bumps the `what4` submodule to the 1.6.* version series and updates the
`.cabal` files in the `macaw` repo accordingly.

Bumping the `what4` submodule also requires bringing in corresponding changes
in the `crucible`, `llvm-pretty`, and `llvm-pretty-bc-parser` submodules, so I
have done that as well.
2024-06-13 04:25:12 -04:00
Eric Mertens
d04f097ba7
Merge pull request #383 from GaloisInc/llvm-pretty-migration
Update llvm-pretty submodule target
2024-05-24 08:09:52 -07:00
Eric Mertens
3b0933d95c Update llvm-pretty submodule target 2024-05-23 16:23:39 -07:00
Valentin Robert
77a6c62352
parse subroutine type declaration formal parameters (#382)
* parse subroutine type declaration formal parameters

This is useful for Reopt as we want to get more accurate type
information for library functions.
2024-05-22 10:47:16 -07:00
Stanislav Lyakhov
4b2f7df44e
Merge pull request #381 from GaloisInc/fix/refinement-cfg-panic
Fix refinement panic caused by duplicate cfg edges
2024-05-10 16:49:31 -07:00
Stanislav Lyakhov
616b266559 Fix refinement panic caused by duplicate cfg edges
Refinement frequently tried to add duplicate edges to the cfg
when encountering jump tables, since jump tables often have common targets
(e.g. because of a `default` case).

Instead of panicking, this is now handled as a benign case where no edge
insertion is needed.
2024-05-10 15:40:11 -07:00
Ryan Scott
442b0e9f00 macaw-base: Fix R_X86_64_RELATIVE offset computation
Fixes #316.
2024-04-11 09:06:50 -04:00
Valentin Robert
e7c4005359
Merge pull request #379 from GaloisInc/vr/bump-ci-actions
bump CI actions versions
2024-04-08 13:09:41 -07:00
Valentin Robert
8e5d9de534 bump CI actions versions 2024-04-08 11:25:03 -07:00
Valentin Robert
da66e03973
Merge pull request #377 from GaloisInc/vr/fix-doc
fix copy-pasted docstring
2024-04-08 11:24:20 -07:00
Valentin Robert
ae380e8e26
Merge pull request #378 from GaloisInc/vr/show-memsymbol
Show instance for MemSymbol
2024-04-08 11:23:57 -07:00
Valentin Robert
4fa43a439d Show instance for MemSymbol 2024-04-08 10:06:58 -07:00
Valentin Robert
0b9d062426 fix copy-pasted docstring 2024-04-08 10:03:47 -07:00
Mike S
67f36b50a4 Update .gitmodules
It appears that Galois took over maintenance of this repo. the submodule is being updated to reflect that and resolve docker build errors
2024-04-04 17:17:13 -04:00
Valentin Robert
1ab280b5f8
Merge pull request #373 from GaloisInc/vr/showf-floatinforepr
add ShowF instance for FloatInfoRepr
2024-03-18 11:16:22 -07:00
Valentin Robert
1d3f2a3331 add ShowF instance for FloatInfoRepr 2024-03-13 15:42:07 -07:00
Ryan Scott
7e1694b0ef macaw-symbolic: Fix interval bounds in mkGlobalPointerValidityPred
Fixes #279.
2024-01-24 18:50:11 -05:00
Langston Barrett
c6c48b6f8b x86-symbolic: Format imports 2024-01-24 11:03:37 -05:00
Langston Barrett
8b90009aec x86-symbolic: Pretty-printing of exceptions 2024-01-24 11:03:37 -05:00
Langston Barrett
50e44e138c x86-symbolic: Add function to extract message from exceptions 2024-01-24 11:03:37 -05:00
Langston Barrett
2df9981f49 aarch32-symbolic: Export AArch32Exception 2024-01-24 11:03:37 -05:00
Langston Barrett
a02343412d x86-symbolic: Structured exceptions for missing primitive function semantics 2024-01-23 16:39:15 -05:00
Langston Barrett
5f8300bd57 x86-symbolic: Create an exception type for missing semantics
This is an exception that consumers might want to catch.
2024-01-23 16:18:16 -05:00
Valentin Robert
e1d0846be7
Merge pull request #366 from GaloisInc/vr/fix-doc
fix incorrect documentation
2024-01-23 09:04:12 -08:00
Valentin Robert
8569727885 fix incorrect documentation 2024-01-22 18:37:11 -08:00
Andrei Stefanescu
9d8cdcc587
Add semantics for prefetch instructions. (#365) 2024-01-10 11:31:36 -08:00
Valentin Robert
c8a8845983
Merge pull request #364 from GaloisInc/vr/minor-cleanups
minor cleanups
2024-01-05 13:27:09 -08:00
Valentin Robert
f8f406df4f minor cleanups 2024-01-05 13:26:44 -08:00
Valentin Robert
a1fa674a5a
Merge pull request #363 from GaloisInc/vr/pp-noreturnfunstatus
add Pretty instance for NoReturnFunStatus
2024-01-05 13:10:56 -08:00
Valentin Robert
0f2264b7c4 add Pretty instance for NoReturnFunStatus 2024-01-05 11:46:25 -08:00
Ryan Scott
aaa5ea1234 Generalize lazy memory model using HasMacawLazySimulatorState
This introduces a `HasMacawLazySimulatorState` data type, which provides a
"classy lens" for accessing a `MacawLazySimulatorState` within some Crucible
personality type. It also generalizes the lazy `macaw-symbolic` memory model in
`Data.Macaw.Symbolic.Memory.Lazy` to be polymorphic over
`HasMacawLazySimulatorState` instances. The upside is that it is now possible
to use the lazy memory model at other personality types besides just
`MacawLazySimulatorState`, making it much easier to extend the memory model.

Because there is a `HasMacawLazySimulatorState` instance for
`MacawLazySimulatorState`, existing code that uses `MacawLazySimulatorState`
should continue to compile without changes.

Fixes #357.
2023-12-12 15:29:48 -05:00
Valentin Robert
7d840065be
Merge pull request #356 from GaloisInc/vr/archaddrwidth
favor `ArchAddrWidth` over `RegAddrWidth (ArchReg ...)`
2023-12-11 12:48:58 -08:00
Valentin Robert
d2f7028e2d favor ArchAddrWidth and ArchSegmentOff type synonyms 2023-12-11 09:53:53 -05:00
Langston Barrett
35b5fcd732 Bump Crucible submodule, adapt to crucible-syntax changes 2023-12-08 09:46:20 -05:00
Valentin Robert
9e09fc86e7
Merge pull request #353 from GaloisInc/vr/remove-extension
remove unused extension
2023-12-07 12:27:35 -08:00
Valentin Robert
822ea653c6
Merge pull request #354 from GaloisInc/vr/derive-show
derive `Show` for `FunctionArgAnalysisFailure`
2023-12-07 12:27:11 -08:00
Valentin Robert
e27f909867
Merge pull request #352 from GaloisInc/vr/typo
fix typo
2023-12-07 10:16:27 -08:00
Valentin Robert
b87da1501b derive Show for FunArgAnalysisFailure
It's sometimes practical to debug the map of analysis failures by
printing them all out, but we don't seem to have any facilities for
printing them.
2023-12-07 09:09:19 -08:00
Valentin Robert
dacd1562f0 remove unused extension 2023-12-07 09:08:52 -08:00
Valentin Robert
9197aaa38f fix typo 2023-12-06 21:21:53 -08:00
Ryan Scott
c2c2a3d6bd macaw-symbolic: Implement MacawFreshSymbolic for all macaw Types
Rather than `error`ing, we now generate fresh constants for all possible
`macaw` `Type`s that are supplied to the `MacawFreshSymbolic` operation.

Fixes #301.
2023-11-17 17:08:34 -05:00
Ryan Scott
2e49eb5351
Merge pull request #350 from GaloisInc/macaw-ppc-pic-ip-addresses
`macaw-ppc`: Don't assume absolute IP addresses when decoding
2023-11-14 15:02:45 -06:00
Ryan Scott
ca64b56808 macaw-{aarch32,ppc}: Remove vestigial InstructionAtUnmappedAddr error types
Now that `macaw-aarch32` and `macaw-ppc` properly handle position-independent
code, the `InstructionAtUnmappedAddr` error (which could only be thrown if an
IP address was found in position-independent code) is never thrown. Let's
delete it.
2023-11-14 13:03:52 -05:00
Ryan Scott
b12b049455 macaw-ppc: Don't assume absolute IP addresses when decoding
`macaw-ppc` was previously assuming that addresses are absolute, which is not
true for position independent executables. Extracting the offset from the
address is sufficient for our purposes here (note that taking the offset from
the `MemSegmentOffset` would not be right, as that offset is relative to the
segment start).

This is the exact same issue that was noticed in
37d8029c00
(in `macaw-aarch32`), but that commit forgot to fix things on the `macaw-ppc`
end.
2023-11-14 12:58:01 -05:00
Ryan Scott
0c6872ad1d
Merge pull request #348 from GaloisInc/elf-edit-T35
`macaw-base`: Resolve PPC{32,64} relocations
2023-11-14 06:29:49 -06:00
Ryan Scott
2fb4ab4291 macaw-base: Resolve PPC{32,64} relocations
This builds on top of the work in
https://github.com/GaloisInc/elf-edit/pull/41. For now, I only add support for
a select few relocation types, leaving the rest as future work.
2023-11-03 11:38:11 -04:00