[8u] RFR: JDK-8147451: Crash in Method::checked_resolve_jmethod_id(_jmethodID*)

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Sat Jun 4 00:32:33 UTC 2016


Hi Shafi,

I agree that this change is safe.
However, there are still two more spots that need to be fixed in the jdk8:

    // During class unloading the methods are cleared, which is different
    // than freed.
    void clear_all_methods() {
      for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
        for (int i = 0; i< number_of_methods; i++) {
-      _methods[i] = NULL;
+      b->_methods[i] = NULL;
        }
      }
    }
@@ -1799,7 +1811,7 @@
      int count = 0;
      for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
        for (int i = 0; i< number_of_methods; i++) {
-        if (_methods[i] != _free_method) count++;
+        if (b->_methods[i] != _free_method) count++;
        }
      }
      return count;
@@ -1871,6 +1883,10 @@
    return o;
  };


You can find this information in one of the bug report comments.

Thanks,
Serguei


On 6/3/16 15:18, Coleen Phillimore wrote:
> This seems like a safe change. Coleen On 5/24/16 4:34 AM, Shafi Ahmad 
> wrote:
>> Hi, Please review the small code change for bug: "JDK-8147451: Crash 
>> in Method::checked_resolve_jmethod_id(_jmethodID*)" on jdk8u-dev 
>> Summary: resolve_jmethod_id() is getting called with invalid 
>> jmethodID and there is no check for validity of the method id inside 
>> this function. So before calling resolve_jmethod_id() we should check 
>> its validity. This code change add this check. Also inside 
>> Method::is_method_id() we are not checking return value of 
>> method_holder(). It may return NULL if method id is not valid so I 
>> have added null check for this too. Webrev: 
>> http://cr.openjdk.java.net/~shshahma/8147451/webrev.00/ Jdk8 bug: 
>> https://bugs.openjdk.java.net/browse/JDK-8147451 Test:  Run jprt 
>> Regards, Shafi 


More information about the hotspot-runtime-dev mailing list