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

[JVMCI] missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail

XMLWordPrintable

    • b165
    • Verified

        Missing range checks on object-based reads via Unsafe in HotSpotMemoryAccessProviderImpl can cause assertions to fail in unsafe.cpp. For example:

        Stack: [0xffff80ff8c7f4000,0xffff80ff8c8f4000], sp=0xffff80ff8c8f1070, free space=1012k
        Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x2468933] void VMError::report_and_die(int,const char*,const char*,__va_list_element*,Thread*,unsigned char*,void*,void*,const char*,int,unsigned long)+0x9e3;; __1cHVMErrorOreport_and_die6Fipkc2pnR__va_list_element_pnGThread_pCpv82iL_v_+0x9e3
        V [libjvm.so+0x2467ee2] void VMError::report_and_die(Thread*,const char*,int,const char*,const char*,__va_list_element*)+0x42;; __1cHVMErrorOreport_and_die6FpnGThread_pkci44pnR__va_list_element__v_+0x42
        V [libjvm.so+0x1529579] void report_vm_error(const char*,int,const char*,const char*,...)+0xf9;; __1cPreport_vm_error6Fpkci11E_v_+0xf9
        V [libjvm.so+0x240917d] void*index_oop_from_field_offset_long(oop,long)+0x21d;; __1cbGindex_oop_from_field_offset_long6FnDoop_l_pv_+0x21d
        V [libjvm.so+0x240b9cd] __type_0 MemoryAccess::get<signed char>()+0x5d;; __1cMMemoryAccessDget4CW_6M_TA_+0x5d
        V [libjvm.so+0x23fc776] Unsafe_GetByte+0x1b6;; Unsafe_GetByte+0x1b6
        J 2703 jdk.internal.misc.Unsafe.getByte(Ljava/lang/Object;J)B java.base@10-internal (0 bytes) @ 0xffff80ffa8827a6c [0xffff80ffa8827900+0x000000000000016c]
        j jdk.vm.ci.hotspot.HotSpotMemoryAccessProviderImpl.readRawValue(Ljdk/vm/ci/meta/Constant;JI)J+62 jdk.internal.vm.ci@10-internal
        j jdk.vm.ci.hotspot.HotSpotMemoryAccessProviderImpl.readPrimitiveConstant(Ljdk/vm/ci/meta/JavaKind;Ljdk/vm/ci/meta/Constant;JI)Ljdk/vm/ci/meta/JavaConstant;+4 jdk.internal.vm.ci@10-internal
        j org.graalvm.compiler.core.common.type.PrimitiveStamp.readConstant(Ljdk/vm/ci/meta/MemoryAccessProvider;Ljdk/vm/ci/meta/Constant;J)Ljdk/vm/ci/meta/Constant;+11 jdk.internal.vm.compiler@10-internal
        j org.graalvm.compiler.nodes.memory.ReadNode.canonicalizeRead(Lorg/graalvm/compiler/nodes/ValueNode;Lorg/graalvm/compiler/nodes/memory/address/AddressNode;Lorg/graalvm/compiler/core/common/LocationIdentity;Lorg/graalvm/compiler/graph/spi/CanonicalizerTool;)Lorg/graalvm/compiler/nodes/ValueNode;+128 jdk.internal.vm.compiler@10-internal
        j org.graalvm.compiler.nodes.memory.ReadNode.canonical(Lorg/graalvm/compiler/graph/spi/CanonicalizerTool;)Lorg/graalvm/compiler/graph/Node;+35 jdk.internal.vm.compiler@10-internal
        J 3737 c1 org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.tryCanonicalize(Lorg/graalvm/compiler/graph/Node;Lorg/graalvm/compiler/graph/NodeClass;)Z jdk.internal.vm.compiler@10-internal (340 bytes) @ 0xffff80ffa88d8db4 [0xffff80ffa88d83c0+0x00000000000009f4]
        J 3740 c1 org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.processNode(Lorg/graalvm/compiler/graph/Node;)Z jdk.internal.vm.compiler@10-internal (204 bytes) @ 0xffff80ffa88d502c [0xffff80ffa88d4ea0+0x000000000000018c]
        J 4337 c1 org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.processWorkSet(Lorg/graalvm/compiler/nodes/StructuredGraph;)V jdk.internal.vm.compiler@10-internal (119 bytes) @ 0xffff80ffa89f991c [0xffff80ffa89f9660+0x00000000000002bc]
        j org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.run(Lorg/graalvm/compiler/nodes/StructuredGraph;)V+107 jdk.internal.vm.compiler@10-internal
        J 4384 c1 org.graalvm.compiler.phases.Phase.run(Lorg/graalvm/compiler/nodes/StructuredGraph;Ljava/lang/Object;)V jdk.internal.vm.compiler@10-internal (6 bytes) @ 0xffff80ffa8a1721c [0xffff80ffa8a171e0+0x000000000000003c]
        J 4063 c1 org.graalvm.compiler.phases.BasePhase.apply(Lorg/graalvm/compiler/nodes/StructuredGraph;Ljava/lang/Object;Z)V jdk.internal.vm.compiler@10-internal (472 bytes) @ 0xffff80ffa89824c4 [0xffff80ffa8981b80+0x0000000000000944]
        j org.graalvm.compiler.phases.Phase.apply(Lorg/graalvm/compiler/nodes/StructuredGraph;Z)V+4 jdk.internal.vm.compiler@10-internal

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

                Created:
                Updated:
                Resolved: