RFR[11u]: JDK-8257604: JNI_ArgumentPusherVaArg leaks valist

Thomas Stüfe thomas.stuefe at gmail.com
Mon Apr 19 09:43:45 UTC 2021


Hi,

may I have reviews for this trivial downport. It does not apply cleanly
since the code diverged too much since JDK11.

JNI_ArgumentPusherVaArg keeps a copy of a va-arg pointer, but does not free
it when going out of scope. Depending on how the libc implements va, this
may be a leak.

Original patch:

https://github.com/openjdk/jdk/commit/ae1eb286

Modified for 11u (I removed the irrelevant protection modifier change from
this downport):

diff -r 530d75a38b9b -r 22ccf5b00e12 src/hotspot/share/prims/jni.cpp
--- a/src/hotspot/share/prims/jni.cpp   Mon Jul 30 16:35:54 2018 -0400
+++ b/src/hotspot/share/prims/jni.cpp   Mon Apr 19 11:35:58 2021 +0200
@@ -953,6 +953,10 @@
     set_ap(rap);
   }

+  ~JNI_ArgumentPusherVaArg() {
+    va_end(_ap);
+  }
+
   // Optimized path if we have the bitvector form of signature
   void iterate( uint64_t fingerprint ) {
     if (fingerprint == (uint64_t)CONST64(-1)) {


Thanks, Thomas


More information about the jdk-updates-dev mailing list