-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8339192: Native annotation parsing code of deprecated annotations causes crash #21030
Conversation
…ses crash
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 158 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@dholmes-ora The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Thanks for looking at this @liach ! |
Indeed, the specs only require us to correctly recognize completely correct format and silently ignore anything that's wrong. For a partially correct structure (including structurally valid but semantically invalid, such as duplicate members), any leniency should be fine. |
Reviewed. Nice tests. Thanks for fixing the problem in both places. I do think, if we have to do more of this stuff in the future, that maybe we should be writing special accessors for the CP itself, ones which can return an error indication instead of throwing an assert or crashing the VM. |
Thanks for taking a look @rose00 ! Can you click the approve button please. :) |
Going to push as commit 969c2af.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit 969c2af. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
There are a couple of runtime visible annotations (
@Deprecated
,@Contended
) that the VM processes during classfile parsing. These are expected to have a form that matches the corresponding Java source code in the JDK. The original test cases for this bug fuzzed the annotation entry in the classfile such that the correspondence was lost and so assertions and other errors could be triggered (depending on debug or release builds). The fix is to fully validate the annotation entries that appear to match, and to ignore them otherwise (which is what is required for unknown attributes/annotations).Each of the jcod test cases is targeted at a specific change in the code (typically the removal of an assertion). There is no intent to try and write exhaustive tests for all possible malformities that might exist for an annotation entry. The original submitted test cases now run without error.
Testing was verified manually by adding debug printing to show we rejected each case as expected. Unfortunately there is no existing mechanism to read back the VM's view of what annotations are present, nor is there any logging to take advantage of. I briefly considered adding a WhiteBox API to query the annotations applied in the VM but I deemed it not worth the effort, particularly because it didn't really help validate the tests in many cases. For example, by default no class/method/field is "Deprecated for Removal" so a test that skips
forRemoval
setting just leaves you with the default situation. You can't actually tell a bad annotation was skipped.Testing
Thanks
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21030/head:pull/21030
$ git checkout pull/21030
Update a local copy of the PR:
$ git checkout pull/21030
$ git pull https://git.openjdk.org/jdk.git pull/21030/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21030
View PR using the GUI difftool:
$ git pr show -t 21030
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21030.diff
Webrev
Link to Webrev Comment