-
Notifications
You must be signed in to change notification settings - Fork 729
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
J9 Verification Issue: did not check uninitialized register? #9271
Comments
@fuzzy000 Both OpenJ9 and Hotspot correctly identify that the code is invalid to run and throw a VerifyError. The error messages are different and the order of checks may be different as well (would need to look closer). There aren't any security implications here as neither JVM runs the invalid bytecode. @ChengJin01 Can you reproduce this and dump the relevant method using an Then we can take a look at the verifier code and validate the order of the checks. |
Thanks for your kind attention!! The reason why I think it is a defect is that in most other cases, these three versions of J9 and corresponding OpenJDK have consistent behaviors. For example, if you try this case antVerify1-consistent.zip (the reproduce steps is the same), you will find that OpenJDK series report |
@DanHeidinga , The problem can be reproduced locally but jdmpview/DDR has got problem in decoding the specified class.
So I directly decoded the class file with
according to the bytecode of the class file, The snaptrace also confirmed this at:
From the error message framework, we already identified the failing location where the bytecode went wrong, which is more useful in trouleshooting verifier-related issues, as compared to the simplified output of Hotspot, As for the output of reason message, this is a generic message of how we deal with any mismatch with the expected type via an unified message template, not specific to uninitialized object in this particular case. In addition, the number of variables in If users prefer more specific/clear message in this case, we can as well adjust the framework there to meet the requirements. |
@fuzzy000, this is the way of how we deal with any mismatch with the expected type (via an unified message template), not specific to a particular verification error. The rule here is to avoid exactly match the output message from RI/Hotspot in each verification error. |
@keithc-ca fyi the |
Thanks for confirming that Hotspot's output is more useful in troubleshooting such verifier-related issues, I hope J9 can be refined in the future soon. |
@fuzzy000, sorry for any confusion(I updated my comment above). What I meant is our message is more straightforward to identify the failing location at the bytecode as compared to Hotspot's concise output without any location of bytecode. @DanHeidinga, please confirm whether we need to add more info the |
Already talked to @DanHeidinga, we won't move forward with this given that the verifier works good in identifying these kind of issues & generating the correct error message specific to the wrong bytecode at right place in these methods. |
Based on @ChengJin01's analysis, I agree. The OpenJ9 verifier is correctly detecting the issue and throwing the required VerifyError. I'm going to close this issue now but @fuzzy000 if you (or anyone else) is interested in opening PRs to make OpenJ9's verifier messages clearer, we'd be open to helping and merging them. |
Thank you all! |
Thanks @fuzzy000. I'll try and get that looked at this week |
Java -version output
The issue happened in following versions:
Summary of problem
We made some changes to a class file in the Apache Ant project (ant-launcher/org/apache/tools/ant/launch/Launcher.class), and let several JVMs run it. We found that compared to the corresponding versions of OpenJDKs, J9 may have Verify issues on the test case.
Take OpenJDK (8u232-b09) and J9 (8u232-b09) as an example:
OpenJDK (8u232-b09):
J9 (8u232-b09):
The point is, J9 reports Type top (current frame, locals[49]) is not assignable to 'reference' type, while OpenJDK reports Accessing value from uninitialized register 49. However, in the
Current Frame
printed by J9, there is only 48 element inlocals
. Since J9 did not check if the register is initialized, maybe it is a bug in J9?Diagnostic files
antVerify1.zip
Steps to reproduce the behavior:
java -cp ant-launcher/ org.apache.tools.ant.launch.Launcher compile jar run
Execution environment
The text was updated successfully, but these errors were encountered: