RFR (XXXS): 8193234: When using -Xcheck:jni an internally allocated buffer can leak

Aleksey Shipilev shade at redhat.com
Thu Feb 7 15:53:11 UTC 2019


On 2/7/19 11:13 AM, David Holmes wrote:
> bug: https://bugs.openjdk.java.net/browse/JDK-8193234
> webrev: http://cr.openjdk.java.net/~dholmes/8193234/webrev

The patch looks good.

> Full details in bug report but basically with the use of GuardedMemory in the checked versions of
> the *ArrayCritical functions we always have to release the GuardedMemory copy.

Ah, oops. It seems fine to free the copy of guarded memory unconditionally. While you are at it,
switch statement can also be simplified by coalescing case labels. It also makes the dichotomy
between "normal" and "abort" paths evident:

  switch (mode) {
  case 0:
  case JNI_COMMIT:
    memcpy(orig_result, carray, sz);
    break;
  case JNI_ABORT:
    break;
  default:
    ...
  }

-Aleksey



More information about the hotspot-runtime-dev mailing list