Commit Graph

2041 Commits

Author SHA1 Message Date
Ryan Scott
2ce038c086 Whitespace only 2023-08-21 08:16:10 -04:00
Valentin Robert
21e3b8f461
Merge pull request #340 from GaloisInc/vr/no-return-call
make error casing uniform
2023-08-14 08:17:10 -07:00
Valentin Robert
7e8f7b979b make error casing uniform
This was the only classifier error message not capitalized.
2023-08-11 16:53:41 -07:00
Valentin Robert
2634b881c6
Merge pull request #335 from GaloisInc/vr/pretty-block-explore
Pretty instance for BlockExploreReason
2023-08-10 14:39:56 -07:00
Valentin Robert
133f3bd9d5 Pretty instance for BlockExploreReason 2023-08-10 14:38:17 -07:00
Valentin Robert
24a18d26d3
Merge pull request #336 from GaloisInc/vr/explore-block-reason
explore BlockExploreReason in DiscoveryEvent
2023-08-10 14:37:45 -07:00
Valentin Robert
4f11cbdedd
Merge pull request #339 from GaloisInc/vr/bump-ci-actions
bump obsolete CI actions
2023-08-10 13:26:18 -07:00
Valentin Robert
6d5bbee7f4 bump obsolete CI actions 2023-08-10 11:20:55 -07:00
Valentin Robert
e8351f29f9
Merge pull request #338 from GaloisInc/vr/investigating-cache-misses
fix CI slowness issues
2023-08-10 11:19:54 -07:00
Valentin Robert
b8bbdcdaf1 fix CI slowness issues
One issue was that we were computing the restore key on the hash of a
file before creating said file when restoring, but after creating the
file when saving, so there was a constant mismatch.

The second issue is that we were not caching dist-newstyle, so we would
always rebuild our "local" dependencies such as binary-symbols,
elf-edit, etc.
2023-08-10 10:19:32 -07:00
Valentin Robert
2d2f22b440
Merge pull request #337 from GaloisInc/vr/unused-pragmas
remove redundant pragmas
2023-08-09 19:55:12 -07:00
Valentin Robert
3638d6e2b0 explore BlockExploreReason in DiscoveryEvent
It can be nice from an external consumer's point of view to have the
reason for the exploration of a block.
2023-08-09 14:44:14 -07:00
Valentin Robert
417e8b780b remove redundant pragmas 2023-08-09 14:31:50 -07:00
Valentin Robert
bc9d04fca7
Merge pull request #333 from GaloisInc/vr/hlint
applying reasonable hlint suggestions
2023-07-28 21:09:20 -07:00
Valentin Robert
e089aa220c applying reasonable hlint suggestions
Co-authored-by: Ryan Scott <rscott@galois.com>

newlines
2023-07-28 10:15:10 -07:00
Valentin Robert
399309e637
Merge pull request #331 from GaloisInc/vr/bump-flexdis
bump flexdis86
2023-07-12 08:43:15 -07:00
Valentin Robert
6c5cc25906 bump flexdis86 2023-07-11 15:27:40 -07:00
Ryan Scott
30fe405a39 Point macaw-loader submodule to master commit 2023-04-18 15:30:30 -04:00
Ryan Scott
2b8be71a41 CI: Always save cache, even on failure 2023-04-18 15:17:23 -04:00
Ryan Scott
9ff819e718 CI: Test GHC 9.2.7 and 9.4.4, drop 8.8.4 and 9.0.2 2023-04-18 15:17:23 -04:00
Ryan Scott
01cfc1db49 Regenerate cabal.project.freeze.ghc-8.10.7 2023-04-18 15:17:23 -04:00
Ryan Scott
7e346081a5 Fix -Wtype-equality-requires-operators warnings
GHC 9.4 adds `-Wtype-equality-requires-operators` to `-Wall`, which warns about
certain uses of type equalities that are not forward-compatible with planned
changes in GHC. See [this
section](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.4?version_id=b60e52482a666d25638d59cd7e86851ddf971dc1#-is-now-a-type-operator)
of the GHC 9.4 Migration Guide. These warnings are easily fixed by enabling the
`TypeOperators` extension.
2023-04-18 15:17:23 -04:00
Ryan Scott
e55add0b51 Support building with GHC 9.4
This contains a variety of tweaks needed to make the libraries in the
`macaw` repo build with GHC 9.4:

* `ST` no longer has a `MonadFail` instance. See
  [this section](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.4?version_id=b60e52482a666d25638d59cd7e86851ddf971dc1#st-is-no-longer-an-instance-of-monadfail)
  of the GHC 9.4 Migration Guide. To adapt to this change, I had to change some
  uses of `fail` to `panic`, and I also had to avoid some partial pattern
  matches in `do`-notation to avoid incurring `MonadFail (ST s)` constraints.
* GHC 9.4 is pickier about undecidable superclass checking. As such, I needed to
  explicitly enable `UndecidableSuperClasses` in a handful of places.
* The following submodule changes were brought in to support building with
  GHC 9.4:
  * `asl-translator`: GaloisInc/asl-translator#51
  * `bv-sized`: GaloisInc/bv-sized#27
  * `bv-sized-float`: GaloisInc/bv-sized-float#4
  * `crucible`: GaloisInc/crucible#1073

    (This also requires bumping the `llvm-pretty`, `llvm-pretty-bc-parser`,
    and `what4` submodules as a side effect)
  * `dismantle`: GaloisInc/dismantle#40
  * `grift`: GaloisInc/grift#8
  * `macaw-loader`: GaloisInc/macaw-loader#17
  * `semmc`: GaloisInc/semmc#79
2023-04-18 15:17:23 -04:00
Ryan Scott
02c2bc468e macaw-base: Introduce *.Panic module
This is cargo-culted from the `*.Panic` module of a similar name in
`macaw-aarch32`. This will be useful in a subsequent commit in which we replace
some unreachable calls to `fail` with `panic`.
2023-04-18 15:17:23 -04:00
Ryan Scott
0686e5d86b Regenerate cabal.project.freeze.ghc-* files 2023-03-21 16:05:53 -04:00
Ryan Scott
e6a3fb0b87 Bump what4 submodule to version 1.4
The only other changes required are (1) deleting an unused dependency on
`what4-serialize`, and (2) raising upper version bounds on `what4`.

This brings in submodule changes from the following:

* GaloisInc/asl-translator#48, which performed a similar `what4` adaptation.
* GaloisInc/semmc#78, which performed a similar `what4` adaptation.
* GaloisIns/crucible#1068, which ensures that everything can build against
  `tasty-sugar >= 2.0` (the version of the library that `what4-1.4` depends on).
2023-03-21 16:05:53 -04:00
Ryan Scott
88d024990b macaw-symbolic: Note lazy memory model in the changelog 2023-03-14 13:27:07 -04:00
Ryan Scott
73b8a49d38 macaw-symbolic: Support newGlobalMemory{,With} in lazy memory model as well 2023-03-14 13:27:07 -04:00
Ryan Scott
dc7c1759f1 macaw-symbolic: Test both memory model configurations in test suites 2023-03-14 13:27:07 -04:00
Ryan Scott
d8fbe228ef macaw-symbolic: Clarify that lazy memory model sacrifices space for time 2023-03-14 13:27:07 -04:00
Ryan Scott
36cade1690 Bundle more options into MemModelConfig
This folds the menagerie of various configuration option arguments to
`macawExtensions` into the `MemModelConfig` data type. The advantage to doing
this is that is will make it easier to extend the memory model configuration
options in the future without needlessly foisting breaking changes on all
`macaw-symbolic` users.

Unfortunately, it does require a breaking change to get to this point, but the
migration path is straightforward for existing code. I have included this
migration story in the `macaw-symbolic` changelog.
2023-03-14 13:27:07 -04:00
Ryan Scott
4a28748030 macaw-symbolic: Add alternative, lazy memory model
The current `macaw-symbolic` memory model has issues when scaling up to
binaries that have several megabytes or more in size. This patch introduces a
new memory model (in `Data.Macaw.Symbolic.Memory.Lazy`) that serves as a mostly
drop-in replacement for the existing memory model (which I now refer to as the
"default" memoy model). The lazy memory model scales better by incrementally
populating the SMT array backing global memory over the course of a run of the
simulator. For the full details, see `Note [Lazy memory model]`.

I performed some refactoring to share common bits between the default and lazy
memory models.

Fixes #282.
2023-03-14 13:27:07 -04:00
Ryan Scott
b5e656c663 Add MemoryModelConfig option for concretizing pointers
This patch introduces a `MemModelConfig` data type for configuring the finer
details of `macaw-symbolic`'s memory model. For now, there is a single option,
which configures whether the memory model should attempt to concretize pointers
during a read or write, which can sometimes be beneficial for performance
reasons. The details of how concretization work can be found in the new
`Data.Macaw.Symbolic.Concretize` module.

Subsequent commits will add more configurable knobs to `MemModelConfig`.

Fixes #323.
2023-03-14 13:27:07 -04:00
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
Ryan Scott
122db57c99 Consistently use symbol table functionality from elf-edit
This:

* Bumps the `elf-edit` submodule to bring in the changes from
  GaloisInc/elf-edit#34.
* Updates `Data.Macaw.Memory.ElfLoader` to consolidate the symbol table logic
  with the corresponding functions from `elf-edit`.

Fixes #277.
2023-02-23 17:16:12 -05:00
Felix Yan
df748376be Correct a typo in Identify.hs 2023-02-21 08:26:10 -05:00
Valentin Robert
eb107820b3
Merge pull request #319 from GaloisInc/vr/hashable-1.4-compatibility
support hashable-1.4
2023-02-20 16:28:49 -08:00
Ryan Scott
9a3e793d30 Bump semmc submodule
This is needed to bring in the changes from #77, which adds support for
`hashable-1.4.*`. With this change, everything in the `macaw` repo now
builds with `hashable-1.4.*`.
2023-02-20 17:49:35 -05:00
Ryan Scott
fa3f82314a macaw-base: Document hashable-related API changes 2023-02-20 17:49:17 -05:00
Valentin Robert
aa127f240f support hashable-1.4 2023-02-16 13:55:30 -08:00
Daniel Matichuk
07b693a309
ARM: add additional return expression match (#315)
handles an extra case where the 'And' has been
simplified out of the return value expression
2022-12-09 12:17:09 -08:00
Daniel Matichuk
a73ec83ff4
ARM: add additional return expression match (#315)
handles an extra case where the 'And' has been
simplified out of the return value expression
2022-12-09 12:16:49 -08:00
Ryan Scott
da06413771 Add test case for movt semantics
This requires bumping the `asl-translator` submodule to bring the changes from
GaloisInc/asl-translator#47, which are necessary for the test case to work.
2022-10-26 18:15:06 -04:00
Ryan Scott
e6420fc006 macaw-symbolic: Include addresses in populateRelocation
When populating `COPY` relocations, it is helpful to know the address of the
relocation so that it can be related back to the name of the global symbol
whose value it is copying. Unfortunately, the type of `populateRelocation` does
not make it straightforward to compute this address. This patch includes three
additional arguments to `populateRelocation` (the relocation's `Memory`, its
`MemSegment`, and its `MemAddr`) to more easily facilitate computing the
address.

This is a breaking API change, albet it is a fairly straightforward change to
adapt to for most consumers.

This is related to #47, although this is not a full fix for the issue.
2022-09-13 15:26:12 -04:00
Ryan Scott
560f292d16 macaw-base: Support loading R_ARM_COPY ELF relocations
We already have support for `R_X86_64_COPY` relocations, so adding support
for `R_ARM_COPY` on the AArch32 side is straightforward.

This is related to #47, although this is not a full fix for the issue.
2022-09-13 15:20:22 -04:00
Tristan Ravitch
87129af093
Add some additional documentation (#303)
Update README.md and document the design of macaw and macaw-symbolic.

Co-authored-by: Ryan Scott <rscott@galois.com>
2022-08-09 18:40:55 -07:00
robdockins
d9525554ca
Merge pull request #310 from GaloisInc/rwd/redundant-checks
Remove redundant "valid pointer" checks from memory loads and stores.
2022-08-08 14:26:40 -07:00
Tristan Ravitch
20c4083330 Add a ChangeLog entry 2022-08-08 12:37:34 -07:00
Robert Dockins
8cf16cdfcd Remove redundant "valid pointer" checks from memory loads and stores.
The internal memory model operations already assert the same checks.
2022-08-03 09:41:58 -07:00
Ryan Scott
734039274d macaw-symbolic: Generalize some uses of CrucibleState to SimState
This patch was motivated by the need to call `doGetGlobal` from a Crucible
override, where the `SimState` is instantiated with `OverrideLang` rather than
`CrucibleLang`, the latter of which is used in the `CrucibleState` type
synonym. While I was in town, I generalized the types of other operations in
`Data.Macaw.Symbolic.MemOps` where it was reasonable.
2022-07-19 17:03:44 -04:00