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

disable post_class_unload() for non JavaThread initiators

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9, 10
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b157
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The current post_class_unload() function can crash the
        VM when a non JavaThread initiates a class unload event.
        It is also possible that the non JavaThread can be
        corrupted instead of crashing the VM.

        Until JDK-8173658 can be fixed for non JavaThread
        initiators of a class unload event, the function should
        disabled.

        $ hg diff src/share/vm//prims/jvmtiExport.cpp
        diff -r 28e800db5a8e src/share/vm/prims/jvmtiExport.cpp
        --- a/src/share/vm/prims/jvmtiExport.cpp Sat Jan 28 14:10:02 2017 -0700
        +++ b/src/share/vm/prims/jvmtiExport.cpp Mon Jan 30 16:31:27 2017 -0700
        @@ -1285,8 +1285,12 @@
             assert(thread->is_VM_thread(), "wrong thread");
         
             // get JavaThread for whom we are proxy
        - JavaThread *real_thread =
        - (JavaThread *)((VMThread *)thread)->vm_operation()->calling_thread();
        + Thread *calling_thread = ((VMThread *)thread)->vm_operation()->calling_thread();
        + if (!calling_thread->is_Java_thread()) {
        + // cannot post an event to a non-JavaThread
        + return;
        + }
        + JavaThread *real_thread = (JavaThread *)calling_thread;
         
             JvmtiEnvIterator it;
             for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dcubed Daniel Daugherty
                Reporter:
                dcubed Daniel Daugherty
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: