Skip to content
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

Backport: [GR-49816] Throw exception for null pointers passed to RuntimeJNIAccess / RuntimeReflection register methods #15

Merged

Conversation

jerboaa
Copy link
Contributor

@jerboaa jerboaa commented Aug 26, 2024

Almost a clean backport of: oracle/graal#6985 to bring upstream community repo more in sync with downstream Mandrel 23.1 release branch.

The only difference is in 6af144f where the original had some import re-shuffeling and the rename from methods to executables, which isn't done in the backport.

Thoughts?

zakkak and others added 5 commits August 26, 2024 16:55
Don't allow null values to be passed to the `register` method of
`RuntimeJNIAccess` and `RuntimeReflection`. Since these are public APIs
GraalVM should either handle null values (by ignoring them in this case)
or throw a `NullPointerException` before creating an asynchronous task
to perform the registration in the analysis, which then results in
`NullPointerException`s being thrown later when it's no longer possible
to understand where the null value originate from.

(cherry picked from commit e6c12dd)
(cherry picked from commit d621dbd)
Not before the register methods, which can miss cases, nor later on in a runnable.

(cherry picked from commit f94551a)
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 26, 2024
@jerboaa
Copy link
Contributor Author

jerboaa commented Aug 26, 2024

@zakkak PTAL. Thank you!

@zakkak zakkak self-requested a review August 27, 2024 10:16
Copy link
Contributor

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jerboaa.

The only difference is in 6af144f where the original had some import re-shuffeling and the rename from methods to executables, which isn't done in the backport.

I understand that the re-shuffling is not applicable (since the imports are not present in this repository) but why not backport the methods to executables renaming? Wouldn't that reduce the chances of future backport conflicts?

@jerboaa
Copy link
Contributor Author

jerboaa commented Aug 27, 2024

[...] why not backport the methods to executables renaming? Wouldn't that reduce the chances of future backport conflicts?

It probably would, but it also adds noise that isn't necessary for the fix. What's more that is what was done on the Mandrel 23.1 side as well so stuck with that. I don't think it's a big deal either way. Let me know what you feel is best and I'll do that.

@zakkak zakkak merged commit 70dd320 into graalvm:master Aug 27, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants