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

[JDK24] Find and consume --illegal-native-access=<VALUE> #20755

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions runtime/oti/jvminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ enum INIT_STAGE {
#define VMOPT_PATCH_MODULE "--patch-module"
#define VMOPT_ILLEGAL_ACCESS "--illegal-access="
#define VMOPT_ENABLE_NATIVE_ACCESS "--enable-native-access"
#define VMOPT_ILLEGAL_NATIVE_ACCESS "--illegal-native-access="

/* JEP 421: Deprecate Finalization for Removal */
#define VMOPT_DISABLE_FINALIZATION "--finalization="
Expand Down Expand Up @@ -722,6 +723,7 @@ enum INIT_STAGE {
#if JAVA_SPEC_VERSION >= 23
#define SYSPROP_SUN_MISC_UNSAFE_MEMORY_ACCESS "sun.misc.unsafe.memory.access"
#endif /* JAVA_SPEC_VERSION >= 23 */
#define SYSPROP_JDK_MODULE_ILLEGALNATIVEACCESS "jdk.module.illegal.native.access"
#define JAVA_BASE_MODULE "java.base"

#define SYSPROP_COM_SUN_MANAGEMENT "-Dcom.sun.management."
Expand Down
11 changes: 11 additions & 0 deletions runtime/vm/vmprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,17 @@ addModularitySystemProperties(J9JavaVM * vm)
}
#endif /* JAVA_SPEC_VERSION >= 17 */

#if JAVA_SPEC_VERSION >= 24
/* Find and consume the last --illegal-native-access option. */
rc = addPropertyForOptionWithEqualsArg(
vm, VMOPT_ILLEGAL_NATIVE_ACCESS,
LITERAL_STRLEN(VMOPT_ILLEGAL_NATIVE_ACCESS),
SYSPROP_JDK_MODULE_ILLEGALNATIVEACCESS);
if (J9SYSPROP_ERROR_NONE != rc) {
goto _end;
}
#endif /* JAVA_SPEC_VERSION >= 24 */

/* Find last --illegal-access */
rc = addPropertyForOptionWithEqualsArg(vm, VMOPT_ILLEGAL_ACCESS, LITERAL_STRLEN(VMOPT_ILLEGAL_ACCESS), SYSPROP_JDK_MODULE_ILLEGALACCESS);

Expand Down