-
Notifications
You must be signed in to change notification settings - Fork 369
Systematically explore bit-flip faults in user-specified variables in Java programs. #295
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
Merged
cyrille-artho
merged 24 commits into
javapathfinder:master
from
y553546436:FaultInjection
Aug 17, 2021
Merged
Systematically explore bit-flip faults in user-specified variables in Java programs. #295
cyrille-artho
merged 24 commits into
javapathfinder:master
from
y553546436:FaultInjection
Aug 17, 2021
Conversation
This file contains hidden or 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
…flipping positions to Java level and (2) call getInt__II__I only once in MJI level and decode. I keep the code of both approaches in Verify.java and JPF_gov_nasa_jpf_vm_Verify.java respectively. The one that takes effect for now is (2) in JPF_gov_nasa_jpf_vm_Verify.java, because with getBitFlip__JII__J method in JPF_gov_nasa_jpf_vm_Verify.java, JPF will execute getBitFlip__JII__J instead of getBitFlip in Verify.java.
…ementation of parameter bit flips in JVMStackFrame.java
…o StackFrame and Types, which can hopefully reduce code duplication later
…notations, but JPF cannot parse local variables internally; add tests for field annotations in BitFlipTest
…lds, parameters and local variables; add tests for them in BitFlipTest.java
… move the examples out
Thank you very much! Merged. The CI issue is documented in issue #294 and does not seem to be related to your code. |
varad64
pushed a commit
to varad64/jpf-core
that referenced
this pull request
Aug 12, 2023
… and javapathfinder#297 and javapathfinder#299 to fix and refactor the Verify class
cyrille-artho
pushed a commit
that referenced
this pull request
Aug 13, 2023
…299 to fix and refactor the Verify class (#403) Co-authored-by: varad64 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Systematically explore bit-flip faults in user-specified variables in Java programs.
Computer hardware is susceptible to errors. For example, radiation may induce error to the hardware and some bit might be flipped. It is important to improve the resiliency of software against hardware errors. One way to evaluate the resiliency of software against hardware errors is by fault injection. This JPF extension aims to systematically inject and explore bit-flip faults in the user specified variables in Java programs.
This website summarizes the contributions of this extension.
What it does
This extension can systematically inject and explore bit-flip faults in the user specified variables in Java programs. The variable to flip can be method parameters, fields, and local variables, and it can be any of the 8 primitive data types. You can specify the variable(s) to flip in three different ways: (1) directly calling the
Verify.getBitFlip
API in the code, (2) adding@BitFlip
annotation to the variables, and (3) specifying in the command line arguments without changing the application code.How to use it
Suppose you have this simple program that does nothing but prints
0
by invoking a method calledfoo
:Now you want to see what will happen if there is some error in the argument passing that causes a bit flip in argument
bar
. Sincebar
is of typeint
, there are 32 cases of which bit is flipped, and you want to see how the program reacts to all of them. You can three options of doing that:Call the
Verify.getBitFlip
API. This approach is straightforward and easy to control. You just need to add one line at the beginning of the methodfoo
(of course you should first importgov.nasa.jpf.vm.Verify
):bar = Verify.getBitFlip(bar, 1)
The second parameter of
getBitFlip
method specifies the number of bits to flip in the variable, which is usually1
, but we support up to7
bits to flip. The first argument can be again, any of the 8 primitive types. Now run this program in JPF, expectedly you will get the following output:The output shows that the JPF explores all the 32 cases of one bit flip in
bar
.Add
@BitFlip
annotation to the variable. This is even simpler than calling thegetBitFlip
API. You just need to annotatebar
like this:public static void foo(@BitFlip int bar)
and then run the program in JPF with this command line argument
+listener=gov.nasa.jpf.listener.BitFlipListener
. You will get the same output as we get for the API option.To explain a bit, this extension injects bit flips to annotated parameters when the argument values are passed, and to annotated fields and local variables when they are written. To support that, we need a JPF listener that checks the annotations of the target variables of each instruction, and that is what the command line argument above is for.
You can also configure the number of bits to flip in the variable by annotate it with
@BitFlip(k)
wherek
is the number, and by default1
.Specify the variable in the command line argument to the JPF. If you don't want any change to your source code, then this is the best option. You can directly run the program in JPF with the following arguments passed to the JPF:
+listener=gov.nasa.jpf.listener.BitFlipListener +bitflip.params=foobar +bitflip.foobar.method=simple.example.SimpleExample.foo(int) +bitflip.foobar.name=bar
The
BitFlipListener
will read the command line arguments and add the specified variables to the watch list, and before a store instruction or invocation instruction, it will check the watch list for variables to flip. The namefoobar
is a configuration name for a parameter bit flip, and the following two arguments specify the method and parameter name offoobar
. Note that you can also configure the number of bits to flip by passing another argument+bitflip.foobar.nbit=k
, and if not specified,k
is by defaut one.More Examples
For more detail, the regression test class
gov.nasa.jpf.test.mc.data.BitFlipTest
documents most of the use senarios in 16 regression tests, from simple usage as shown above, to more complex usage like combining the annotations and the command line arguments.We also have a GitHub repository to show how this extension could be used to evaluate error detection algorithms' resiliency against bit flip faults. Specifically, it contains the implementation of the Cyclic redundancy check (CRC) and International Standard Book Number (ISBN) algorithms where you can try out this extension.