RFR: 8258077: Using -Xcheck:jni can lead to a double-free after JDK-8193234

Mauro Lacy github.com+11656534+maurolacy at openjdk.java.net
Fri Dec 11 11:36:02 UTC 2020


On Fri, 11 Dec 2020 08:17:13 GMT, Mauro Lacy <github.com+11656534+maurolacy at openjdk.org> wrote:

> I also just re-checked the JDK source and it seems this code also suffers from the COMMIT-only problem:
> 
> ./jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c

I've taken a look and yes, I think you're right. The line
`        (*env)->ReleasePrimitiveArrayCritical(env, jOut, outBufP, JNI_COMMIT);`

should probably use `JNI_ABORT` if there's an error, and `0` if it's a normal cleanup.

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

PR: https://git.openjdk.java.net/jdk/pull/1697


More information about the hotspot-dev mailing list