-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set and use writability permission bits on JVM static fields #1293
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6b7545b
Add internal support for `jvm_modified` declarations.
43a4af8
Add implementations for `jvm_modifies` commands.
88b70a9
Add saw-script primitives for three `jvm_modifies` variants:
88295be
Add regression tests for jvm_verify soundness bugs (issue #900).
7aa7301
Set and use writability permission bits on JVM static fields.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule crucible
updated
3 files
+10 −2 | crucible-jvm/src/Lang/Crucible/JVM/Context.hs | |
+38 −15 | crucible-jvm/src/Lang/Crucible/JVM/Simulate.hs | |
+7 −4 | crucible-jvm/src/Lang/Crucible/JVM/Translation/Class.hs |
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,2 @@ | ||
%.class: %.java | ||
javac -g $< |
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,18 @@ | ||
class Test | ||
{ | ||
static int a; | ||
int b; | ||
|
||
public void set(int x) { | ||
a = x; | ||
b = x; | ||
} | ||
public int test_a(int x) { | ||
set(x); | ||
return a; | ||
} | ||
public int test_b(int x) { | ||
set(x); | ||
return b; | ||
} | ||
} |
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,90 @@ | ||
// This is a regression test for saw-script issue #900; it tests whether | ||
// `jvm_verify` will successfully verify a spec that does not specify a | ||
// new value for a field, when the method actually does modify that | ||
// field. For soundness of compositional verification, it is required | ||
// that such a verification will fail. | ||
// https://github.com/GaloisInc/saw-script/issues/900 | ||
|
||
enable_experimental; | ||
c <- java_load_class "Test"; | ||
|
||
let set_spec_1 = | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
x <- jvm_fresh_var "x" java_int; | ||
jvm_execute_func [this, jvm_term x]; | ||
jvm_field_is this "b" (jvm_term x); | ||
}; | ||
|
||
let set_spec_2 = | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
x <- jvm_fresh_var "x" java_int; | ||
jvm_execute_func [this, jvm_term x]; | ||
jvm_static_field_is "a" (jvm_term x); | ||
}; | ||
|
||
set_ov_1 <- jvm_unsafe_assume_spec c "set" set_spec_1; | ||
set_ov_2 <- jvm_unsafe_assume_spec c "set" set_spec_2; | ||
|
||
let one = jvm_term {{ 1:[32] }}; | ||
let two = jvm_term {{ 2:[32] }}; | ||
|
||
// A correct spec for test_a. | ||
jvm_verify c "test_a" [] false | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
jvm_static_field_is "a" one; | ||
jvm_execute_func [this, two]; | ||
jvm_static_field_is "a" two; | ||
jvm_field_is this "b" two; | ||
jvm_return two; | ||
} | ||
z3; | ||
|
||
// An incorrect spec for test_a, which can be proven using the bogus | ||
// spec set_ov_1. | ||
jvm_verify c "test_a" [set_ov_1] false | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
jvm_static_field_is "a" one; | ||
jvm_execute_func [this, two]; | ||
jvm_static_field_is "a" one; | ||
jvm_field_is this "b" two; | ||
jvm_return one; | ||
} | ||
z3; | ||
|
||
// A correct spec for test_b. | ||
jvm_verify c "test_b" [] false | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
jvm_static_field_is "a" one; | ||
jvm_field_is this "b" one; | ||
jvm_execute_func [this, two]; | ||
jvm_static_field_is "a" two; | ||
jvm_field_is this "b" two; | ||
jvm_return two; | ||
} | ||
z3; | ||
|
||
// An incorrect spec for test_b, which can be proven using the bogus | ||
// spec set_ov_2. | ||
jvm_verify c "test_b" [set_ov_2] false | ||
do { | ||
this <- jvm_alloc_object "Test"; | ||
jvm_static_field_is "a" one; | ||
jvm_field_is this "b" one; | ||
jvm_execute_func [this, two]; | ||
jvm_static_field_is "a" two; | ||
jvm_field_is this "b" one; | ||
jvm_return one; | ||
} | ||
z3; | ||
|
||
// It should be impossible to verify the bogus set_spec_1. | ||
fails (jvm_verify c "set" [] false set_spec_1 z3); | ||
|
||
// It should be impossible to verify the bogus set_spec_2. | ||
// FIXME: this should fail | ||
jvm_verify c "set" [] false set_spec_2 z3; |
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 @@ | ||
$SAW test.saw |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in understanding that making this fail, as it should, is the "second half" of #1290?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly right.