-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8365526: Crash with null Symbol passed to SystemDictionary::resolve_or_null #28438
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
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
|
@coleenp This change is no longer ready for integration - check the PR body for details. |
Webrevs
|
tkrodriguez
left a comment
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.
Thanks for tracking this down! Looks good.
| // Only add a new resolution error if one hasn't been found for this constant pool index. In this case, | ||
| // resolution succeeded but there's an error in this nest host. | ||
| assert(pool->resolved_klass_at(which) != nullptr, "klass is should be resolved if there is no entry"); | ||
| ResolutionErrorTable::add_entry(pool, which, message); |
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.
I might be inclined to swap the cases.
if (entry == nullptr) {
...
} else if (entry->nest_host_error() == nullptr) {
...
}
Is there ever a situation where replacing an entry in ResolutionErrorTable is correct? Maybe there should be a check for that somewhere?
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.
Yes, this reorganization would look nicer.
No, there's a never a situation where calling replacing an entry in the ResolutionErrorTable is correct because this HashTable::put() function leaks the value that it has replaced. I've been testing an assert for this.
In general, this function can leak the value but I did a test and we don't leak anything but this one right now. But I think we should fix this separately.
The vm was crashing because the constant pool couldn't find the resolution error in the ResolutionErrorEntry error field.
There are two uses of ResolutionErrorEntry in the ResolutionErrorTable. The key to this table is {ConstantPool, cp-index}. In this crash, multiple threads were racing to record nest_host_errors in the case where resolution failed. In this case, there was already a ResolutionErrorEntry in the table for the constant pool resolution failure. In the 'if' case of add_nest_host_error we check to see if there's already a nest_host_error assuming it's the same error, then the 'else' case was unconditionally adding a ResolutionErrorEntry with just the nest host message. Calling HashTable::put() with this entry with just the nest host message, was overwriting the entry with the constant pool resolution error, ie. the other fields. The crash happened in ConstantPool::throw_resolution_error() because the error field was overwritten (and leaked too).
Add a null check before calling ResolutionErrorEntry add entry. Also added an assert that we only add a resolution error for nest host errors in the case of success since in the case of failure there will always already be a ResolutionErrorEntry for the failing constant pool and cp index and we don't want to overwrite that again.
Tested with submitted reproducer and tier1-4.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28438/head:pull/28438$ git checkout pull/28438Update a local copy of the PR:
$ git checkout pull/28438$ git pull https://git.openjdk.org/jdk.git pull/28438/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28438View PR using the GUI difftool:
$ git pr show -t 28438Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28438.diff
Using Webrev
Link to Webrev Comment