JDK-8213466 : Method::checked_resolve_jmethod_id() could do better checks
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2018-11-07
  • Updated: 2021-07-07
  • Resolved: 2021-07-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
  if (mid == NULL) return NULL;
  Method* o = resolve_jmethod_id(mid);
  if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
    return NULL;
  }
  return o;
};

We could, in addition, test that:
- Method* is a valid metaspace pointer
- Method* is a method

see Metaspace::contains() and Method::is_valid_method(), respectively.

Can be done either unconditionally, or at least as assert, if it costs too much time.




Comments
I fixed this with JDK-8268364.
07-07-2021

It seems like this bug is related: JDK-8181110 jvmti/hotswap test crashes in Method::checked_resolve_jmethod_id(_jmethodID*)
04-03-2021