-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8261395: C1 crash "cannot make java calls from the native compiler" #3913
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
Conversation
…ss_at but can use resolved_klass_at. Now exceptions are truly impossible.
This avoids any possibility of class loading or executing any Java code and removes all possibility of exceptions in this part of the nestmate verification process.
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora The |
@dholmes-ora |
@dholmes-ora |
@dholmes-ora |
Webrevs
|
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.
LGTM. Just a suggestion for an assert.
@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 40 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 |
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.
LGTM. Thanks for fixing this.
Harold
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.
Looks good but I think you should remove the conversion of Thread to JavaThread because it's also going to conflict with your later change.
super(parent); | ||
} | ||
|
||
static byte[] getBytesForClass(String name) throws IOException { |
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.
There's a ClassUnloadCommon library call for this.
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. I copied this from another test. If there's an existing utility I will switch to it.
/contributor remove @coleenp |
@coleenp Only the author (@dholmes-ora) is allowed to issue the |
test/hotspot/jtreg/runtime/Nestmates/protectionDomain/TestDifferentProtectionDomains.java
Show resolved
Hide resolved
…ert the introduction of "current".
- need to add java.security.manager=allow just to be safe - simplify logic to read classfile from disk (ref ClassUnloadCommon.getClassData())
Thanks for the reviews Coleen, Ioi and Harold. Minor updates in place based on Coleen's feedback and suggestions. Please re-review. @coleenp we wouldn't have arrived at this simplified name-check-only version without all of the discussions and investigations of how to fix the more complex version. So credit remains where credit is due. :) Thanks, |
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.
Looks good to me!
@@ -93,7 +76,8 @@ | |||
// Check for target class | |||
if (name.startsWith(TARGET)) { | |||
try { | |||
byte[] buff = getBytesForClass(name); | |||
String clzFile = name.replaceAll("\\.", "/") + ".class"; | |||
byte[] buff = getResourceAsStream(clzFile).readAllBytes(); |
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.
There's a ClassUnloadCommon.getBytesForClass(name) that you could have called that does essentially what these two lines do. Maybe it's different enough to have this, so it's up to you to change it.
/integrate |
@dholmes-ora Since your change was applied there have been 46 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit e828a93. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Mailing list message from David Holmes on hotspot-runtime-dev: On 8/05/2021 12:08 am, Harold Seigel wrote:
Thanks for the review Harold! David |
Mailing list message from David Holmes on hotspot-runtime-dev: Hi Coleen, On 12/05/2021 9:34 am, Coleen Phillimore wrote:
It would be "wrong" to actually call that as it calls Thanks for the review. David |
If a nest host and a nest member are associated with different protection domains it can lead to execution of Java code (to validate the "new" protection domain) during a nestmate access check, if nest membership verification has not yet been performed. This will cause assertion or guarantee failures if executed by a JIT compiler thread during access checks.
After much discussion and trying different solutions it was decided that the existing logic for nest membership validation unnecessarily tries to resolve constant-pool entries, when it suffices that the symbolic entry in the constant-pool has the same name as the class being checked. Given this check occurs after we have verified the nest host and the purported member are loaded by the same classloader and in the same runtime package, there can only be one class with the name of the member, and that is the member class. Hence resolution of the constant-pool entry serves no purpose but introduces the complexity of dealing with exceptions and avoiding Java code execution in compiler threads.
@iklam contributed to an earlier version of the fix, and devised the initial testcase approach.
@coleenp also contributed to an earlier version of the fix.
Thanks to both Coleen and Ioi for their insights, discussions and contributions.
Testing:
Thanks,
David
Progress
Issue
Reviewers
Contributors
<iklam@openjdk.org>
<coleenp@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3913/head:pull/3913
$ git checkout pull/3913
Update a local copy of the PR:
$ git checkout pull/3913
$ git pull https://git.openjdk.java.net/jdk pull/3913/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3913
View PR using the GUI difftool:
$ git pr show -t 3913
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3913.diff