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

AsyncGetCallTrace can cause SIGBUS on M1

    XMLWordPrintable

Details

    • svc
    • b19
    • aarch64
    • os_x

    Backports

      Description

        Calling AsyncGetCallTrace can trigger writing into the PcDescCache. This causes a SIGBUS error when the current thread is not WXWrite mode.
        This is due a missing `MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current());)` to ensure that the thread is in this mode during the walking of the thread stack.

        This error occurs sporadically but can be easily reproduced using https://github.com/parttimenerd/asgct_bottom with the renaissance dotty benchmark.

        I could not reproduce this issue with JFR or async-profiler, but fixing it is simple.

        Thanks to Martin and Matthias from my team for helping to debug this bug.

        Excerpt from the hs_err file:

        ```
        Stack: [0x000000016d554000,0x000000016d757000], sp=0x000000016d750900, free space=2034k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.dylib+0xdd5a08] PcDescCache::add_pc_desc(PcDesc*)+0x60
        V [libjvm.dylib+0xdde49c] PcDescContainer::find_pc_desc_internal(unsigned char*, bool, PcDescSearch const&)+0x564
        V [libjvm.dylib+0xf4271c] PcDescContainer::find_pc_desc(unsigned char*, bool, PcDescSearch const&)+0x9c
        V [libjvm.dylib+0xa740c0] CompiledMethod::find_pc_desc(unsigned char*, bool)+0xa0
        V [libjvm.dylib+0xde1eb0] CompiledMethod::pc_desc_near(unsigned char*)+0x28
        V [libjvm.dylib+0x70d96c] is_decipherable_compiled_frame(JavaThread*, frame*, CompiledMethod*)+0x104
        V [libjvm.dylib+0x70d574] find_initial_Java_frame(JavaThread*, frame*, frame*, Method**, int*)+0x304
        V [libjvm.dylib+0x70d038] forte_fill_call_trace_given_top(JavaThread*, ASGCT_CallTrace*, int, frame)+0x98
        V [libjvm.dylib+0x70cf48] AsyncGetCallTrace+0x2dc
        C [libbottom.so+0x43c4] asgctGSTHandler(__darwin_ucontext*)+0xbc
        C [libbottom.so+0x528c] signalHandler(int, __siginfo*, void*)+0x20
        C [libsystem_platform.dylib+0x42a4] _sigtramp+0x38
        C 0x110180011a9e15f0
        j jdk.internal.jimage.ImageReader$SharedImageReader$$Lambda+0x00000008011cef68.visit(Ljdk/internal/jimage/ImageLocation;)V+9 java.base@21-internal
        j jdk.internal.jimage.ImageReader$SharedImageReader.visitLocation(Ljdk/internal/jimage/ImageLocation;Ljdk/internal/jimage/ImageReader$SharedImageReader$LocationVisitor;)V+61 java.base@21-internal
        j jdk.internal.jimage.ImageReader$SharedImageReader.handleModulesSubTree(Ljava/lang/String;Ljdk/internal/jimage/ImageLocation;)Ljdk/internal/jimage/ImageReader$Node;+42 java.base@21-internal
        j jdk.internal.jimage.ImageReader$SharedImageReader.buildNode(Ljava/lang/String;)Ljdk/internal/jimage/ImageReader$Node;+69 java.base@21-internal
        ```

        Attachments

          Issue Links

            Activity

              People

                jbechberger Johannes Bechberger
                jbechberger Johannes Bechberger
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: