You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add llvm_points_to_bitfield and enable_lax_loads_and_stores
This adds support for writing specifications that talk about bitfields in LLVM
code by way of the new `llvm_points_to_bitfield` command. Broadly speaking,
`llvm_points_to_bitfield ptr fieldName rhs` is like
`llvm_points_to (llvm_field ptr fieldName) rhs`, except that `fieldName` is
required to be the name of a field within a bitfield. The salient details are:
* LLVM bitcode itself does not a built-in concept of bitfields, but LLVM's
debug metadata does. Support for retrieving bitfield-related metadata was
added to `llvm-pretty` in GaloisInc/llvm-pretty#90, so this patch bumps the
`llvm-pretty` submodule to incorporate it. This patch also updates the
`crucible` submodule to incorporate corresponding changes in
GaloisInc/crucible#936.
* The `LLVMPointsTo` data type now has a new `LLVMPointsToBitfield` data
constructor that stores all of the necessary information related to the
`llvm_points_to_bitfield` command. As a result, the changes in this patch
are fairly insulated from the rest of SAW, as most of the new code involves
adding additional cases to handle `LLVMPointsToBitfield`.
* Two of the key new functions are `storePointsToBitfieldValue` and
`matchPointsToBitfieldValue`, which implement the behavior of
`llvm_points_to_bitfield` in pre- and post-conditions. These functions
implement the necessary bit-twiddling to store values in and retrieve values
out of bitfield. I have left extensive comments in each function describing
how all of this works.
* Accompanying `llvm_points_to_bitfield` is a new set of
`{enable,disable}_lax_loads_and_stores` command, which toggles the
Crucible-side option of the same name. When `enable_lax_loads_and_stores` is
on, reading from uninitialized memory will return a symbolic value rather
than failing outright. This is essential to be able to deal with LLVM bitcode
involving bitfields, as reading a field from a bitfield involves reading the
entire bitfield at once, which may include parts of the struct that have not
been initialized yet.
* There are various `test_bitfield_*` test cases under `intTests` to test
examples of bitfield-related specifications that should and should not
verify.
* I have also updated `saw-remote-api` and `saw-client` to handle bitfields as
well, along with a Python-specific test case.
Fixes#1461.
0 commit comments