> This update is fixing a couple of `nsk/jvmti/ scenarios` tests. > The tests in a JVMTI `ClassFileLoadHook` callback provide new class file > bytes with the result returned by JNI `GetByteArrayElements()`. It violates > the JVMTI `ClassFileLoadHook` spec saying: > > "The agent must allocate the space for the modified class file data buffer > using the memory allocation function Allocate because the VM is responsible > for freeing the new class file data buffer using Deallocate." > > Please, see the JVMTI ClassFileLoadHook spec: > > https://docs.oracle.com/en/java/javase/24/docs/specs/jvmti.html#ClassFileLoadHook > > It is the root cause of a memory corruption detected with the VM option > `-Xcheck:jni`. > The fix is to convert a JNI allocated array returned by > `GetByteArrayElements()` to a JMVTI allocated array. New conversion function > `jni_array_to_jvmti_allocated()` is added to the`jvmti_common.hpp`. > > Testing: > - ran updated tests individually > - TBD: submit mach5 tiers 1-6
Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision: review: add a call to ReleaseByteArrayElements to new function jni_array_to_jvmti_allocated ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25422/files - new: https://git.openjdk.org/jdk/pull/25422/files/05bbcf5a..9f128798 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25422&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25422&range=00-01 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25422.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25422/head:pull/25422 PR: https://git.openjdk.org/jdk/pull/25422