RFR: 8258077: Using -Xcheck:jni can lead to a double-free after JDK-8193234 [v3]
David Holmes
dholmes at openjdk.java.net
Fri Jan 8 03:55:22 UTC 2021
> The fix in JDK-8193234 had an unintended consequence for the Release<X>ArrayElements API, which is now fixed in this issue.
>
> I'd like to thank Mauro Lacy and Dmitry Timofeev for raising, analysing and discussing this issue. You can follow the thread here:
>
> http://mail.openjdk.java.net/pipermail/hotspot-dev/2020-December/047248.html
>
> Although the fix itself is very basic I found a couple of other issues along the way, so I have staged the commits as follows for ease of understanding:
>
> Step 1: added a regression test for the current double-free problem
> Step 2: Only try to print the GuardedMemory info in debug builds as it can lead to secondary crashes
> Step 3: Fix incorrect function names in the error messages and cleanup formatting
> Step 4: Revert the change from JDK-8193234
> Step 5: Add the memory-leak test from JDK-8193234 as a manual test
> Step 6: Fix the JNI_COMMIT memory leak only for the case of ReleasePrimitiveArrayCritical
>
> Finally I had to tweak the test to fix a nativepath problem.
>
> Testing:
> - tiers 1-4 (tier 4 includes the test run with -Xcheck:jni)
> - local testing of the new tests
>
> Thanks,
> David
David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
- Update copyright for 2021
- Merge branch 'master' into 8258077
- Fix minor nits from Dan's review.
- Updated test to fix nativepath problem.
- Step 6: Fix the JNI_COMMIT memory leak only for the case of ReleasePrimitiveArrayCritical
- Step 5: Add the memory-leak test from JDK-8193234 as a manual test
- Step 4: Revert the change from JDK-8193234
- Step 3: Fix incorrect function names in the error messages and cleanup formatting.
- Step 2: Only try to print the GuardedMemory info in debug builds as it can trigger a secondary crash.
- 8258077: Using -Xcheck:jni can lead to a double-free after JDK-8193234
Step 1: added a regression test
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1816/files
- new: https://git.openjdk.java.net/jdk/pull/1816/files/b989bc52..5194f351
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1816&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1816&range=01-02
Stats: 33257 lines in 1276 files changed: 12558 ins; 9584 del; 11115 mod
Patch: https://git.openjdk.java.net/jdk/pull/1816.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1816/head:pull/1816
PR: https://git.openjdk.java.net/jdk/pull/1816
More information about the hotspot-runtime-dev
mailing list