Skip to content

Commit 7f1a012

Browse files
authored
Merge pull request #1672 from GaloisInc/rwd/ux-fixes
Some minor UX fixes
2 parents 26fca7a + 90cd951 commit 7f1a012

File tree

15 files changed

+348
-108
lines changed

15 files changed

+348
-108
lines changed

doc/manual/manual.md

+32-28
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ llvm_verify :
18861886
String ->
18871887
[CrucibleMethodSpec] ->
18881888
Bool ->
1889-
CrucibleSetup () ->
1889+
LLVMSetup () ->
18901890
ProofScript SatResult ->
18911891
TopLevel CrucibleMethodSpec
18921892
~~~~
@@ -1915,7 +1915,7 @@ jvm_verify :
19151915
TopLevel JVMMethodSpec
19161916
~~~~
19171917

1918-
Now we describe how to construct a value of type `CrucibleSetup ()` (or
1918+
Now we describe how to construct a value of type `LLVMSetup ()` (or
19191919
`JVMSetup ()`).
19201920

19211921
## Structure of a Specification
@@ -1929,7 +1929,7 @@ A specifications for Crucible consists of three logical components:
19291929
* A specification of the expected final value of the program state.
19301930

19311931
These three portions of the specification are written in sequence within
1932-
a `do` block of `CrucibleSetup` (or `JVMSetup`) type. The command
1932+
a `do` block of `LLVMSetup` (or `JVMSetup`) type. The command
19331933
`llvm_execute_func` (or `jvm_execute_func`) separates the
19341934
specification of the initial state from the specification of the final
19351935
state, and specifies the arguments to the function in terms of the
@@ -1946,7 +1946,7 @@ contain fresh variables. These are created in a specification with the
19461946
`llvm_fresh_var` and `jvm_fresh_var` commands rather than
19471947
`fresh_symbolic`.
19481948

1949-
* `llvm_fresh_var : String -> LLVMType -> CrucibleSetup Term`
1949+
* `llvm_fresh_var : String -> LLVMType -> LLVMSetup Term`
19501950

19511951
* `jvm_fresh_var : String -> JavaType -> JVMSetup Term`
19521952

@@ -2022,14 +2022,14 @@ Once the initial state has been configured, the `llvm_execute_func`
20222022
command specifies the parameters of the function being analyzed in terms
20232023
of the state elements already configured.
20242024

2025-
* `llvm_execute_func : [SetupValue] -> CrucibleSetup ()`
2025+
* `llvm_execute_func : [SetupValue] -> LLVMSetup ()`
20262026

20272027
## Return Values
20282028

20292029
To specify the value that should be returned by the function being
20302030
verified use the `llvm_return` or `jvm_return` command.
20312031

2032-
* `llvm_return : SetupValue -> CrucibleSetup ()`
2032+
* `llvm_return : SetupValue -> LLVMSetup ()`
20332033
* `jvm_return : JVMValue -> JVMSetup ()`
20342034

20352035
## A First Simple Example
@@ -2076,7 +2076,7 @@ and more complex systems than otherwise possible.
20762076
The `llvm_verify` and `jvm_verify` functions return values of
20772077
type `CrucibleMethodSpec` and `JVMMethodSpec`, respectively. These
20782078
values are opaque objects that internally contain both the information
2079-
provided in the associated `JVMSetup` or `CrucibleSetup` blocks and
2079+
provided in the associated `JVMSetup` or `LLVMSetup` blocks and
20802080
the results of the verification process.
20812081

20822082
Any of these `MethodSpec` objects can be passed in via the third
@@ -2128,7 +2128,7 @@ point to allocated memory before they are called. The `llvm_alloc`
21282128
command allows you to specify that a function expects a particular
21292129
pointer to refer to an allocated region appropriate for a specific type.
21302130

2131-
* `llvm_alloc : LLVMType -> CrucibleSetup SetupValue`
2131+
* `llvm_alloc : LLVMType -> LLVMSetup SetupValue`
21322132

21332133
This command returns a `SetupValue` consisting of a pointer to the
21342134
allocated space, which can be used wherever a pointer-valued
@@ -2151,7 +2151,7 @@ In LLVM, it's also possible to construct fresh pointers that do not
21512151
point to allocated memory (which can be useful for functions that
21522152
manipulate pointers but not the values they point to):
21532153

2154-
* `llvm_fresh_pointer : LLVMType -> CrucibleSetup SetupValue`
2154+
* `llvm_fresh_pointer : LLVMType -> LLVMSetup SetupValue`
21552155

21562156
The NULL pointer is called `llvm_null` in LLVM and `jvm_null` in
21572157
JVM:
@@ -2161,7 +2161,7 @@ JVM:
21612161

21622162
One final, slightly more obscure command is the following:
21632163

2164-
* `llvm_alloc_readonly : LLVMType -> CrucibleSetup SetupValue`
2164+
* `llvm_alloc_readonly : LLVMType -> LLVMSetup SetupValue`
21652165

21662166
This works like `llvm_alloc` except that writes to the space
21672167
allocated are forbidden. This can be useful for specifying that a
@@ -2181,7 +2181,7 @@ appropriate. In most cases, however, it's more useful to state that a
21812181
pointer points to some specific (usually symbolic) value, which you can
21822182
do with the `llvm_points_to` command.
21832183

2184-
* `llvm_points_to : SetupValue -> SetupValue -> CrucibleSetup ()`
2184+
* `llvm_points_to : SetupValue -> SetupValue -> LLVMSetup ()`
21852185
takes two `SetupValue` arguments, the first of which must be a pointer,
21862186
and states that the memory specified by that pointer should contain the
21872187
value given in the second argument (which may be any type of
@@ -2196,7 +2196,7 @@ type as another through casts, it can be useful to specify that a
21962196
pointer points to a value that does not agree with its static type.
21972197

21982198
* `llvm_points_to_untyped : SetupValue -> SetupValue ->
2199-
CrucibleSetup ()` works like `llvm_points_to` but omits type
2199+
LLVMSetup ()` works like `llvm_points_to` but omits type
22002200
checking. Rather than omitting type checking across the board, we
22012201
introduced this additional function to make it clear when a type
22022202
reinterpretation is intentional. As an alternative, one
@@ -2231,7 +2231,7 @@ of `llvm_fresh_var` and `llvm_elem` or `llvm_field` commands.
22312231
However, the following function can simplify the common case
22322232
where you want every element or field to have a fresh value.
22332233

2234-
* `llvm_fresh_expanded_val : LLVMType -> CrucibleSetup SetupValue`
2234+
* `llvm_fresh_expanded_val : LLVMType -> LLVMSetup SetupValue`
22352235

22362236
The `llvm_struct_value` function normally creates a `struct` whose layout
22372237
obeys the alignment rules of the platform specified in the LLVM file
@@ -2300,7 +2300,7 @@ special care is required to write SAW specifications involving bitfields. For
23002300
this reason, there is a dedicated `llvm_points_to_bitfield` function for this
23012301
purpose:
23022302

2303-
* `llvm_points_to_bitfield : SetupValue -> String -> SetupValue -> CrucibleSetup ()`
2303+
* `llvm_points_to_bitfield : SetupValue -> String -> SetupValue -> LLVMSetup ()`
23042304

23052305
The type of `llvm_points_to_bitfield` is similar that of `llvm_points_to`,
23062306
except that it takes the name of a field within a bitfield as an additional
@@ -2356,7 +2356,7 @@ them.
23562356
Mutable global variables that are accessed in a function must first be allocated
23572357
by calling `llvm_alloc_global` on the name of the global.
23582358

2359-
* `llvm_alloc_global : String -> CrucibleSetup ()`
2359+
* `llvm_alloc_global : String -> LLVMSetup ()`
23602360

23612361
This ensures that all global variables that might influence the function are
23622362
accounted for explicitly in the specification: if `llvm_alloc_global` is
@@ -2461,17 +2461,21 @@ rise to specific final conditions. For these cases, you can specify an
24612461
arbitrary predicate as a precondition or post-condition, using any
24622462
values in scope at the time.
24632463

2464-
* `llvm_precond : Term -> CrucibleSetup ()`
2465-
* `llvm_postcond : Term -> CrucibleSetup ()`
2464+
* `llvm_precond : Term -> LLVMSetup ()`
2465+
* `llvm_postcond : Term -> LLVMSetup ()`
2466+
* `llvm_assert : Term -> LLVMSetup ()`
24662467
* `jvm_precond : Term -> JVMSetup ()`
24672468
* `jvm_postcond : Term -> JVMSetup ()`
2469+
* `jvm_assert : Term -> JVMSetup ()`
24682470

2469-
These two commands take `Term` arguments, and therefore cannot describe
2470-
the values of pointers. The `llvm_equal` command states that two
2471-
`SetupValue`s should be equal, and can be used in either the initial or
2472-
the final state.
2471+
These commands take `Term` arguments, and therefore cannot describe
2472+
the values of pointers. The "assert" variants will work in either pre-
2473+
or post-conditions, and are useful when defining helper functions
2474+
that, e.g., state datastructure invariants that make sense in both
2475+
phases. The `llvm_equal` command states that two `SetupValue`s should
2476+
be equal, and can be used in either the initial or the final state.
24732477

2474-
* `llvm_equal : SetupValue -> SetupValue -> CrucibleSetup ()`
2478+
* `llvm_equal : SetupValue -> SetupValue -> LLVMSetup ()`
24752479

24762480
The use of `llvm_equal` can also sometimes lead to more efficient
24772481
symbolic execution when the predicate of interest is an equality.
@@ -2487,7 +2491,7 @@ simulation of the function. To skip simulation altogether, one can use:
24872491

24882492
~~~
24892493
llvm_unsafe_assume_spec :
2490-
LLVMModule -> String -> CrucibleSetup () -> TopLevel CrucibleMethodSpec
2494+
LLVMModule -> String -> LLVMSetup () -> TopLevel CrucibleMethodSpec
24912495
~~~
24922496

24932497
Or, in the experimental JVM implementation:
@@ -2634,7 +2638,7 @@ Ghost state variables do not initially have any particluar type, and can
26342638
store data of any type. Given an existing ghost variable the following
26352639
function can be used to specify its value:
26362640
2637-
* `llvm_ghost_value : Ghost -> Term -> CrucibleSetup ()`
2641+
* `llvm_ghost_value : Ghost -> Term -> LLVMSetup ()`
26382642
26392643
Currently, this function can only be used for LLVM verification, though
26402644
that will likely be generalized in the future. It can be used in either
@@ -2679,7 +2683,7 @@ above.
26792683
#### Utility Functions
26802684
26812685
We first define the function
2682-
`alloc_init : LLVMType -> Term -> CrucibleSetup SetupValue`.
2686+
`alloc_init : LLVMType -> Term -> LLVMSetup SetupValue`.
26832687
26842688
`alloc_init ty v` returns a `SetupValue` consisting of a pointer to memory
26852689
allocated and initialized to a value `v` of type `ty`. `alloc_init_readonly`
@@ -2702,7 +2706,7 @@ let alloc_init_readonly ty v = do {
27022706
~~~~
27032707
27042708
We now define
2705-
`ptr_to_fresh : String -> LLVMType -> CrucibleSetup (Term, SetupValue)`.
2709+
`ptr_to_fresh : String -> LLVMType -> LLVMSetup (Term, SetupValue)`.
27062710
27072711
`ptr_to_fresh n ty` returns a pair `(x, p)` consisting of a fresh symbolic
27082712
variable `x` of type `ty` and a pointer `p` to it. `n` specifies the
@@ -2724,7 +2728,7 @@ let ptr_to_fresh_readonly n ty = do {
27242728
~~~~
27252729
27262730
Finally, we define
2727-
`oneptr_update_func : String -> LLVMType -> Term -> CrucibleSetup ()`.
2731+
`oneptr_update_func : String -> LLVMType -> Term -> LLVMSetup ()`.
27282732
27292733
`oneptr_update_func n ty f` specifies the behavior of a function that takes
27302734
a single pointer (with a printable name given by `n`) to memory containing a
@@ -2753,7 +2757,7 @@ Cryptol implementation and it is asserted that the pointers do in fact point to
27532757
these expected values.
27542758
27552759
~~~~
2756-
let quarterround_setup : CrucibleSetup () = do {
2760+
let quarterround_setup : LLVMSetup () = do {
27572761
(y0, p0) <- ptr_to_fresh "y0" (llvm_int 32);
27582762
(y1, p1) <- ptr_to_fresh "y1" (llvm_int 32);
27592763
(y2, p2) <- ptr_to_fresh "y2" (llvm_int 32);

doc/manual/manual.pdf

-95 Bytes
Binary file not shown.

saw-remote-api/src/SAWServer.hs

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Verifier.SAW.TypedTerm (TypedTerm, CryptolModule)
4747

4848
import SAWScript.Crucible.LLVM.Builtins (CheckPointsToType)
4949
import SAWScript.Crucible.LLVM.X86 (defaultStackBaseAlign)
50-
import qualified SAWScript.Crucible.Common as CC (defaultSAWCoreBackendTimeout)
50+
import qualified SAWScript.Crucible.Common as CC (defaultSAWCoreBackendTimeout, PathSatSolver(..))
5151
import qualified SAWScript.Crucible.Common.MethodSpec as CMS (ProvedSpec, GhostGlobal)
5252
import qualified SAWScript.Crucible.LLVM.MethodSpecIR as CMS (SomeLLVM, LLVMModule)
5353
import SAWScript.Options (Options(..), processEnv, defaultOptions)
@@ -239,6 +239,8 @@ initialState readFileFn =
239239
, rwPreservedRegs = []
240240
, rwAllocSymInitCheck = True
241241
, rwCrucibleTimeout = CC.defaultSAWCoreBackendTimeout
242+
, rwPathSatSolver = CC.PathSat_Z3
243+
, rwSkipSafetyProofs = False
242244
}
243245
return (SAWState emptyEnv bic [] ro rw M.empty)
244246

saw-script.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ executable saw
221221
, cryptol-saw-core
222222
, aig
223223

224-
GHC-options: -O2 -Wall -Werror -threaded -fno-ignore-asserts -fno-spec-constr-count
224+
GHC-options: -O2 -Wall -Werror -threaded -fno-ignore-asserts -fno-spec-constr-count -rtsopts
225225

226226
test-suite integration_tests
227227
type: exitcode-stdio-1.0

0 commit comments

Comments
 (0)