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

JEP 472: Prepare to Restrict the Use of JNI #19680

Closed
ChengJin01 opened this issue Jun 11, 2024 · 3 comments
Closed

JEP 472: Prepare to Restrict the Use of JNI #19680

ChengJin01 opened this issue Jun 11, 2024 · 3 comments
Assignees
Labels
comp:vm JEP project:panama Used to track Project Panama related work

Comments

@ChengJin01
Copy link

Summary (from https://openjdk.org/jeps/472)

Issue warnings about uses of the Java Native Interface (JNI) and adjust warnings from the Foreign Function & Memory (FFM) API to be consistent with JNI. All such warnings aim to prepare developers for a future release that provides integrity by default by uniformly restricting JNI and the FFM API. Application developers can avoid current warnings and future restrictions by selectively enabling the interaction of Java and native code where it is critical to the application.

Goals

  • Preserve the status of JNI as a standard way to interoperate with native code.
  • Prepare the Java ecosystem for a future release that disallows interoperation with native code by default, whether via JNI or the FFM API. As of that release, application developers will have to explicitly enable the use of JNI and the FFM API at startup.
  • Align the use of JNI and the FFM API so that library maintainers can migrate from one to the other without changing any command line options.

FYI: @tajila, @pshipton

@ChengJin01 ChengJin01 added comp:vm project:panama Used to track Project Panama related work labels Jun 11, 2024
@ChengJin01
Copy link
Author

ChengJin01 commented Jun 11, 2024

The JEP is still in the Candidate status (which is not targeted for JDK23) but the related code has been implemented via https://bugs.openjdk.org/browse/JDK-8331671. So it is expected to be merged to the repo soon if no more concerns in there.

@pshipton pshipton added this to the Java 24 milestone Jun 11, 2024
@pshipton
Copy link
Member

pshipton commented Jun 11, 2024

We'll assume Java 24 for now. It's in the Java 24 plan.

@pshipton pshipton added the JEP label Nov 11, 2024
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 4, 2024
After reading the last --illegal-native-access=<VALUE> option,
the system property jdk.module.illegal.native.access is assigned
the specified <VALUE>.

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 4, 2024
After reading the last --illegal-native-access=<VALUE> option,
the system property jdk.module.illegal.native.access is assigned
the specified <VALUE>.

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 9, 2024
Add native access checks in System.load/loadLibrary to comply with
JEP472 (Prepare to Restrict the Use of JNI).

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 9, 2024
Add native access checks in System.load/loadLibrary to comply with
JEP472 (Prepare to Restrict the Use of JNI).

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 16, 2024
A new version of ClassLoader.findNative has been introduced, which
accepts the Java method name and the Java class where the native
method is declared as input parameters. It performs native access
checks to comply with JEP 472 (Prepare to Restrict the Use of JNI).

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
babsingh added a commit to babsingh/openj9 that referenced this issue Dec 16, 2024
A new version of ClassLoader.findNative has been introduced, which
accepts the Java method name and the Java class where the native
method is declared as input parameters. It performs native access
checks to comply with JEP 472 (Prepare to Restrict the Use of JNI).

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
tajila pushed a commit to tajila/openj9 that referenced this issue Jan 3, 2025
After reading the last --illegal-native-access=<VALUE> option,
the system property jdk.module.illegal.native.access is assigned
the specified <VALUE>.

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
@babsingh babsingh closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm JEP project:panama Used to track Project Panama related work
Projects
None yet
Development

No branches or pull requests

3 participants