RFR: 8357601: Checked version of JNI Release<type>ArrayElements needs to filter out known wrapped arrays

David Holmes dholmes at openjdk.org
Mon Jun 30 01:41:55 UTC 2025


The checked version of `Get`/`Release<type>ArrayElements` uses `GuardedMemory` to perform error checking. When releasing the array the code needs to check for the known array tags from the other JNI APIs and report an error.

We also expand `GuardedMemory` to allow for a second tag word so that we can discriminate additional allocation sites i.e. identifying use of `Get`/`SetPrimitiveArrayCritical`. And add further robustness to guard verification by using `SafeFetch`.

-------------

Commit messages:
 - newlines at end-of-file
 - Merge branch 'master' into 8357601-jni
 - interim
 - fixed indent
 - Missing header include on Windows slowdebug
 - Improve robustness of guard verification by using SafeFetch
 - Merge branch 'master' into 8357601-jni
 - 8357601: Checked version of JNI Release<type>ArrayElements needs to filter out known wrapped arrays

Changes: https://git.openjdk.org/jdk/pull/25444/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25444&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357601
  Stats: 343 lines in 6 files changed: 321 ins; 6 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/25444.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25444/head:pull/25444

PR: https://git.openjdk.org/jdk/pull/25444


More information about the hotspot-dev mailing list