Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223915

JVMTI Spec: can_redefine_any_class capability spec is inconsistent

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      It is just to make the can_redefine_any_class capability spec more clear and consistent.
    • Interface Kind:
      Other

      Description

      Summary

      The spec of the "can_redefine_any_class" needs to be more clear and consistent.

      Problem

      The spec of the "can_redefine_any_class" states:

      "Can modify (retransform or redefine) any modifiable class. See IsModifiableClass."

      It neglects to state: " (can_redefine_classes must also be set)".

      The relationship between the capabilities "can_redefine_any_class" and "can_retransform_any_class" is also not clear.

      The "can_redefine_any_class" spec states:

      "Can modify (retransform or redefine)..."

      which means it allows both to REDEFINE and to RETRANSFORM any class.

      Then there can be a confusion on how to understand the capability "can_retransform_any_class".

      So, the spec needs to be more clear.

      A similar fragment in the "can_redefine_any_class" capability spec in IsModifiableClass() also needs to be fixed:

        "If possessed then all classes (except primitive, array, and some implementation defined classes)
         are modifiable (redefine or retransform)." 

      Solution

      The suggestion is to change two fragments in the JVMTI spec below.

      Fragment #1: The "can_redefine_any_class" capability spec:

      from:
         "Can modify (retransform or redefine) any modifiable class. See IsModifiableClass."
      
      to:
        "RedefineClasses can be called on any modifiable class. See IsModifiableClass.
         (can_redefine_classes must also be set)"

      Fragment #2: The "can_redefine_any_class" capability spec in the IsModifiableClass():

      from:
         "If possessed then all classes (except primitive, array, and some implementation defined classes)
          are modifiable (redefine or retransform)." 
      
      to:
        "If possessed then all classes (except primitive, array, and some implementation defined classes)
         are modifiable with RedefineClasses." 

      Specification

      Please, find the jvmti-specdiff.zip in the attachments. The suggested fix for spec is:

      diff -r 6a60270af76b src/hotspot/share/prims/jvmti.xml
      --- a/src/hotspot/share/prims/jvmti.xml Mon May 13 20:45:03 2019 -0700
      +++ b/src/hotspot/share/prims/jvmti.xml Wed May 22 01:51:44 2019 -0700
      @@ -7443,7 +7443,7 @@
             <capabilities>
               <capability id="can_redefine_any_class">
                 If possessed then all classes (except primitive, array, and some implementation defined
      -          classes) are modifiable (redefine or retransform).
      +          classes) are modifiable with <functionlink id="RedefineClasses"/>.
               </capability>
               <capability id="can_retransform_any_class">
                 If possessed then all classes (except primitive, array, and some implementation defined
      @@ -10205,8 +10205,10 @@
             </capabilityfield>
             <capabilityfield id="can_redefine_any_class">
          <description>
      -          Can modify (retransform or redefine) any modifiable class.
      +          <functionlink id="RedefineClasses"/> can be called on any modifiable class.
                 See <functionlink id="IsModifiableClass"/>.
      +          (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
      +          must also be set)
          </description>
             </capabilityfield>
             <capabilityfield id="can_get_current_thread_cpu_time">

      The latest JVMTI spec specdiff is:

      http://cr.openjdk.java.net/~sspitsyn/webrevs/2019/8046018-jvmti-cap-spec.3/jvmti-specdiff/

      The latest JVMTI spec is:

      http://cr.openjdk.java.net/~sspitsyn/webrevs/2019/8046018-jvmti-cap-spec.3/jvmti.html

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sspitsyn Serguei Spitsyn
              Reporter:
              sspitsyn Serguei Spitsyn
              Reviewed By:
              Alan Bateman, Chris Plummer, Daniel Daugherty, David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: