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

HotSpotJVMCIRuntime.getMirror can crash

XMLWordPrintable

    • master

      The methods in HotSpotJVMCIRuntime converting a ResolvedJavaMethod to an Executable[1] and a ResolvedJavaField to a Field[2] will crash in jargraal if passed a <clinit> method or an internal field[3].

      For example, when trying to get the mirror for the java.lang.Thread.jvmti_thread_state injected field[4]:

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00000001017d4664, pid=98392, tid=33027
      #
      ...
      Stack: [0x0000000172404000,0x0000000172607000], sp=0x0000000172604be0, free space=2050k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.dylib+0x110664] Annotations::make_java_array(Array<unsigned char>*, JavaThread*)+0x1c
      V [libjvm.dylib+0x8f417c] Reflection::new_field(fieldDescriptor*, JavaThread*)+0x324
      V [libjvm.dylib+0x5ed238] c2v_asReflectionField(JNIEnv_*, _jobject*, _jobject*, long, int)+0x3c4
      J 2276 jdk.vm.ci.hotspot.CompilerToVM.asReflectionField(Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;JI)Ljava/lang/reflect/Field; jdk.internal.vm.ci@26-internal (0 bytes) @ 0x0000000112bca3a8 [0x0000000112bca300+0x0
      0000000000000a8]
      J 2297 c1 jdk.vm.ci.hotspot.CompilerToVM.asReflectionField(Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;I)Ljava/lang/reflect/Field; jdk.internal.vm.ci@26-internal (11 bytes) @ 0x000000010b3a37b0 [0x000000010b3a35c0+0
      x00000000000001f0]
      J 2296 c1 jdk.vm.ci.hotspot.HotSpotJDKReflection.getField(Ljdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl;)Ljava/lang/reflect/Field; jdk.internal.vm.ci@26-internal (82 bytes) @ 0x000000010b39c654 [0x000000010b39c080+0x00
      000000000005d4]
      J 2295 c1 jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getMirror(Ljdk/vm/ci/meta/ResolvedJavaField;)Ljava/lang/reflect/Field; jdk.internal.vm.ci@26-internal (29 bytes) @ 0x000000010b39be88 [0x000000010b39bb00+0x0000000000000388
      ]



      [1] https://github.com/openjdk/jdk/blob/9bef2d1610647dec18f9e81cbac3dddbbf99dd6d/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java#L792method
      [2] https://github.com/openjdk/jdk/blob/9bef2d1610647dec18f9e81cbac3dddbbf99dd6d/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java#L807
      [3] https://github.com/openjdk/jdk/blob/9bef2d1610647dec18f9e81cbac3dddbbf99dd6d/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaField.java#L57
      [4] https://github.com/openjdk/jdk/blob/9bef2d1610647dec18f9e81cbac3dddbbf99dd6d/src/hotspot/share/classfile/javaClasses.hpp#L371

            dnsimon Douglas Simon
            dnsimon Douglas Simon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: