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

SA: jstack crash when target has mismatched bitness (Linux)

XMLWordPrintable

    • svc
    • b22
    • generic
    • linux


        On Linux, attaching a 32-bit "jstack -m" to a 64-bit target, or vice versa, will produce a crash, e.g.

        # JRE version: Java(TM) SE Runtime Environment (8.0-b77) (build 1.8.0-ea-b77)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b18 mixed mode linux-amd64 compressed oops)
        # Problematic frame:
        # C [libsaproc.so+0x1f06] read_section_data+0x1f


        jstack without -m (only the java stacktrace) has no problem.

        The stacktrace is:
        (gdb) bt
        #0 0x00007f6f55a85ba5 in raise (sig=<value optimised out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        #1 0x00007f6f55a896b0 in abort () at abort.c:92
        #2 0x00007f6f5540bf85 in os::abort(bool) () from /opt/java/64/test8/jre/lib/amd64/server/libjvm.so
        #3 0x00007f6f55591247 in VMError::report_and_die() () from /opt/java/64/test8/jre/lib/amd64/server/libjvm.so
        #4 0x00007f6f5540fdf0 in JVM_handle_linux_signal () from /opt/java/64/test8/jre/lib/amd64/server/libjvm.so
        #5 <signal handler called>
        #6 0x00007f6f4b421f06 in read_section_data () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #7 0x00007f6f4b4221de in find_section_by_name () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #8 0x00007f6f4b4222e0 in open_file_from_debug_link () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #9 0x00007f6f4b4224d9 in build_symtab_from_debug_link () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #10 0x00007f6f4b422c65 in build_symtab_internal () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #11 0x00007f6f4b422d6b in build_symtab () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #12 0x00007f6f4b4234df in add_lib_info_fd () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #13 0x00007f6f4b4233c1 in add_lib_info () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #14 0x00007f6f4b4242fa in read_lib_info () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #15 0x00007f6f4b4244a1 in Pgrab () from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #16 0x00007f6f4b426a15 in Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0(int0_t) ()
           from /opt/java/64/test8/jre/lib/amd64/libsaproc.so
        #17 0x00007f6f500fa734 in ?? ()
        #18 0x00007f6f440a0000 in ?? ()



        Solaris prohibits the mixing of bitness, and gives:

        Error attaching to process: Attach failed : debuggee is 64 bit, use java -d64 for debugger
        or:
        Error attaching to process: debuggee is 32 bit, use 32 bit java for debugger

        A similar restriction is likely needed on Linux.

        The crash appears to happen since 6932270.
        Prior to that change, a missing symbol error happened when mixing bitness.
        But also to be fair on that change the matched case may not have worked either, due to:
        DebuggerException: get_thread_regs failed for a lwp

              kevinw Kevin Walls
              kevinw Kevin Walls
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: