-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #435 from GaloisInc/at-396-remove-lss
This removes all connections to the old LSS (llvm-verifier) code now that the Crucible-based equivalent is sufficiently robust. The one downside is that llvm_symexec no longer exists. We may want to implement something with similar but better functionality eventually. Fixes #396.
- Loading branch information
Showing
65 changed files
with
928 additions
and
3,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule llvm-verifier
deleted from
b48809
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
enable_deprecated; | ||
c <- java_load_class "Double"; | ||
t <- java_extract c "f" java_pure; | ||
t <- crucible_java_extract c "f"; | ||
print_term t; | ||
write_aig "java_f.aig" t; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
enable_deprecated; | ||
let f_spec = do { | ||
llvm_ptr "x" (llvm_int 32); | ||
llvm_assert_null "x"; | ||
llvm_return {{ 1 : [32] }}; | ||
llvm_verify_tactic abc; | ||
let f_spec1 = do { | ||
p <- crucible_alloc (llvm_int 32); | ||
crucible_execute_func [p]; | ||
crucible_return (crucible_term {{ 0 : [32] }}); | ||
}; | ||
|
||
let f_spec2 = do { | ||
llvm_ptr "x" (llvm_int 32); | ||
llvm_return {{ 0 : [32] }}; | ||
llvm_verify_tactic abc; | ||
crucible_execute_func [crucible_null]; | ||
crucible_return (crucible_term {{ 1 : [32] }}); | ||
}; | ||
|
||
m <- llvm_load_module "assert-null.bc"; | ||
llvm_verify m "f" [] f_spec; | ||
llvm_verify m "f" [] f_spec2; | ||
crucible_llvm_verify m "f" [] false f_spec1 abc; | ||
crucible_llvm_verify m "f" [] false f_spec2 abc; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <assert.h> | ||
|
||
void f(int x) { | ||
assert(x != 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let f_spec = do { | ||
x <- crucible_fresh_var "x" (llvm_int 32); | ||
crucible_precond {{ x > 0 }}; | ||
crucible_execute_func [crucible_term x]; | ||
}; | ||
|
||
m <- llvm_load_module "assert.bc"; | ||
crucible_llvm_verify m "f" [] true f_spec abc; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
enable_deprecated; | ||
let add_setup : LLVMSetup () = do { | ||
x <- llvm_var "x" (llvm_int 32); | ||
y <- llvm_var "y" (llvm_int 32); | ||
llvm_return {{ x + y : [32] }}; | ||
llvm_verify_tactic abc; | ||
let add_setup = do { | ||
x <- crucible_fresh_var "x" (llvm_int 32); | ||
y <- crucible_fresh_var "y" (llvm_int 32); | ||
crucible_execute_func [crucible_term x, crucible_term y]; | ||
crucible_return (crucible_term {{ x + y : [32] }}); | ||
}; | ||
|
||
let dbl_setup : LLVMSetup () = do { | ||
x <- llvm_var "x" (llvm_int 32); | ||
llvm_return {{ x + x : [32] }}; | ||
llvm_verify_tactic abc; | ||
let dbl_setup = do { | ||
x <- crucible_fresh_var "x" (llvm_int 32); | ||
crucible_execute_func [crucible_term x]; | ||
crucible_return (crucible_term {{ x + x : [32] }}); | ||
}; | ||
|
||
let main : TopLevel () = do { | ||
m <- llvm_load_module "basic.bc"; | ||
add_ms <- llvm_verify m "add" [] add_setup; | ||
llvm_verify m "dbl" [add_ms] dbl_setup; | ||
print "Done."; | ||
}; | ||
m <- llvm_load_module "basic.bc"; | ||
add_ms <- crucible_llvm_verify m "add" [] false add_setup abc; | ||
crucible_llvm_verify m "dbl" [add_ms] false dbl_setup abc; | ||
print "Done."; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,30 @@ | ||
enable_deprecated; | ||
import "dotprod.cry"; | ||
m <- llvm_load_module "dotprod_struct.bc"; | ||
xs <- fresh_symbolic "xs" {| [2][32] |}; | ||
ys <- fresh_symbolic "ys" {| [2][32] |}; | ||
let allocs = [ ("x", 1), ("y", 1), ("x->0", 2), ("y->0", 2) ]; | ||
let inputs = [ ("*(x->0)", {{ xs }}, 2) | ||
, ("*(y->0)", {{ ys }}, 2) | ||
, ("x->1", {{ 2:[32] }}, 1) | ||
, ("y->1", {{ 2:[32] }}, 1) | ||
]; | ||
let outputs = [("return", 1)]; | ||
t <- llvm_symexec m "dotprod_struct" allocs inputs outputs true; | ||
thm <- abstract_symbolic {{ t == dotprod xs ys }}; | ||
prove_print abc thm; | ||
|
||
let dotprod_spec = do { | ||
llvm_ptr "x" (llvm_struct "struct.vec_t"); | ||
llvm_ptr "y" (llvm_struct "struct.vec_t"); | ||
llvm_ptr "x->0" (llvm_array 2 (llvm_int 32)); | ||
llvm_ptr "y->0" (llvm_array 2 (llvm_int 32)); | ||
xs <- llvm_var "*(x->0)" (llvm_array 2 (llvm_int 32)); | ||
xn <- llvm_var "x->1" (llvm_int 32); | ||
ys <- llvm_var "*(y->0)" (llvm_array 2 (llvm_int 32)); | ||
yn <- llvm_var "y->1" (llvm_int 32); | ||
llvm_sat_branches true; | ||
llvm_assert_eq "x->1" {{ 2:[32] }}; | ||
llvm_assert_eq "y->1" {{ 2:[32] }}; | ||
llvm_return {{ dotprod xs ys }}; | ||
llvm_verify_tactic abc; | ||
let alloc_init ty v = do { | ||
p <- crucible_alloc ty; | ||
crucible_points_to p v; | ||
return p; | ||
}; | ||
|
||
let ptr_to_fresh n ty = do { | ||
x <- crucible_fresh_var n ty; | ||
p <- alloc_init ty (crucible_term x); | ||
return (x, p); | ||
}; | ||
|
||
let dotprod_wrap_spec = do { | ||
llvm_ptr "x" (llvm_struct "struct.vec_t"); | ||
llvm_ptr "y" (llvm_struct "struct.vec_t"); | ||
llvm_ptr "x->0" (llvm_array 2 (llvm_int 32)); | ||
llvm_ptr "y->0" (llvm_array 2 (llvm_int 32)); | ||
xs <- llvm_var "*(x->0)" (llvm_array 2 (llvm_int 32)); | ||
xn <- llvm_var "x->1" (llvm_int 32); | ||
ys <- llvm_var "*(y->0)" (llvm_array 2 (llvm_int 32)); | ||
yn <- llvm_var "y->1" (llvm_int 32); | ||
llvm_assert_eq "x->1" {{ 2:[32] }}; | ||
llvm_assert_eq "y->1" {{ 2:[32] }}; | ||
llvm_return {{ dotprod xs ys }}; | ||
llvm_verify_tactic do { | ||
simplify (add_cryptol_defs ["ecEq"] (cryptol_ss ())); | ||
simplify (add_prelude_defs ["implies"] basic_ss); | ||
simplify (add_prelude_eqs ["bvEq_refl"] basic_ss); | ||
simplify (add_prelude_eqs ["or_True1"] basic_ss); | ||
trivial; | ||
}; | ||
let dotprod_spec n = do { | ||
let nt = crucible_term {{ `n : [32] }}; | ||
(xs, xsp) <- ptr_to_fresh "xs" (llvm_array n (llvm_int 32)); | ||
(ys, ysp) <- ptr_to_fresh "ys" (llvm_array n (llvm_int 32)); | ||
let xval = crucible_struct [ xsp, nt ]; | ||
let yval = crucible_struct [ ysp, nt ]; | ||
xp <- alloc_init (llvm_struct "struct.vec_t") xval; | ||
yp <- alloc_init (llvm_struct "struct.vec_t") yval; | ||
crucible_execute_func [xp, yp]; | ||
crucible_return (crucible_term {{ dotprod xs ys }}); | ||
}; | ||
|
||
dotprod_ov <- llvm_verify m "dotprod_struct" [] dotprod_spec; | ||
llvm_verify m "dotprod_wrap" [dotprod_ov] dotprod_wrap_spec; | ||
m <- llvm_load_module "dotprod_struct.bc"; | ||
|
||
dotprod_ov <- crucible_llvm_verify m "dotprod_struct" [] true (dotprod_spec 2) z3; | ||
crucible_llvm_verify m "dotprod_wrap" [dotprod_ov] true (dotprod_spec 2) z3; |
Oops, something went wrong.