-
Notifications
You must be signed in to change notification settings - Fork 251
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
Unsoundness of JBMC in the presence of Multithreading. #8264
Comments
The command line needs to be
|
I'm sorry, I could not get the command-line you provided to work. I always get the Warning However, when I add the two JAR files to the classpath and the --java-threading option like this, then JBMC runs successfuly:
However, when I run it like that, then I get the same result as reported above. JBMC states "VERIFICATION SUCCESSFUL" although running the above program with |
Yes, that's the correct commandline on Windows.
I get
We are both using JBMC and the JAR files built from tag
|
I tried it again in an Ubuntu-VM with jbmc 5.95.1 and java 17.0.10 On Ubuntu, the command-line you provided works. Result:
I hence tried to get even closer to your configuration and replaced the Java 17 JDK by a Java 1.8 JDK. And when I ran JBMC with the above command-line against the JDK1.8-compiled class files, the verification indeed failed. However, it was not complaining about the assertion in line 23, but the NullPointerCheck for line 22 failed (a System.out.println).
I am stunned. We are BOTH using Ubuntu (22.04.4 LTS in my case). We are BOTH using cbmc 5.95.1 and java 1.8. Why are we still getting different results? |
Here the files that I use:
|
Thanks for posting your files. I tried to reproduce your result. However, when I ask YOUR jbmc to verify YOUR Race.class using YOUR Jars on my Ubuntu VM, then I get the following output instead:
As you can see, the Verification also fails, but it does not fail because it cannot verify the assertion in line 23 of Race.java, but it fails because a NullPointerCheck in Thread.java fails to verify. It still seems to make a significant difference if it is run on my Ubuntu VM or on your Ubuntu Machine. And this difference is NOT due to the Java Bytecode and NOT due to the JBMC binary or its JARs. |
Since we seem to have a difference in our environment, I reproduced the problem in Docker.
In order to reproduce it,
|
CBMC version: 5.95.1
Operating system: MS Windows 11 Enterprise Version 22H2, Build 22621.3447
Java version: openjdk version "17.0.5" 2022-10-18
Exact command line resulting in the issue: "C:\Program Files\cbmc\bin\jbmc.exe" Race
What behaviour did you expect: I would have expected JBMC to see that b[0] == false at the assert() statement.
What happened instead: JBMC reported VERIFICATION SUCCESSFUL.
In the following java program:
JBMC verifies all Verification Conditions.and thus reports VERIFICATION SUCCESSFUL.
However, executing this program with
java -ea Race
gives an AssertionError in 100% of the cases.The text was updated successfully, but these errors were encountered: