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

[Zero] Undefined behaviour in src/os_cpu/linux_zero/vm/os_linux_zero.cpp

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      generic
    • OS:
      linux

      Backports

        Description

        The in code in JDK 8 in src/os_cpu/linux_zero/vm/os_linux_zero.cpp around line 408 reads:

         extern "C" {
           int SpinPause() {
           }

        That function is supposed to return int, but doesn't. Hence, it's UB and the compiler is free to do anything.

        This causes weird crashes for bootcycle-images builds with newer GCC compilers (perhaps GCC 8). One instance is this on 32bit arm for example:

        openjdk/build/jdk8.build/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch (from /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/tools/compileproperties/CompileProperties.java) (/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/tools/compileproperties/CompileProperties.java /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/tools/genstubs/GenStubs.java newer)
        + /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/images/j2sdk-image/bin/javac -XDignore.symbol.file=true -g -Xlint:all,-deprecation -Werror -g -Xprefer:source -implicit:none -sourcepath /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/tools:/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/src/share/classes -d /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/bootcycle-build/langtools/btclasses @/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch.tmp
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (os_linux_zero.cpp:254), pid=30774, tid=0xa37ff460
        # fatal error: caught unhandled signal 11
        #
        # JRE version: OpenJDK Runtime Environment (8.0_171-b10) (build 1.8.0_171-b10)
        # Java VM: OpenJDK Zero VM (25.171-b10 interpreted mode linux-arm )
        # Core dump written. Default location: /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/core or core.30774
        #
        # An error report file with more information is saved as:
        # /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/hs_err_pid30774.log
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.java.com/bugreport/crash.jsp
        #
        /bin/bash: line 1: 30774 Aborted (core dumped) /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/images/j2sdk-image/bin/javac -XDignore.symbol.file=true -g -Xlint:all,-deprecation -Werror -g -Xprefer:source -implicit:none -sourcepath "/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make/tools:/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/src/share/classes" -d /builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/bootcycle-build/langtools/btclasses @/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/build/jdk8.build/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch.tmp
        gmake[2]: *** No rule to make target 'all', needed by 'default'. Stop.
        gmake[2]: Leaving directory '/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk/langtools/make'
        gmake[1]: *** [/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk//make/Main.gmk:84: langtools-only] Error 2
        gmake[1]: Leaving directory '/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk'
        make: *** [/builddir/build/BUILD/java-1.8.0-openjdk-1.8.0.171-4.b10.fc29.arm/openjdk//make/Main.gmk:178: bootcycle-images-only] Error 2

        This has been fixed in JDK 9+ via JDK-8143245, but that seems unsuitable for a backport.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sgehwolf Severin Gehwolf
                  Reporter:
                  sgehwolf Severin Gehwolf
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: