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

C2 crashes with SIGFPE due to a division that floats above its zero check

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b29

      Backports

        Description

        The attached fuzzer test fails with SIGFPE:

        To reproduce:
        $ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test -XX:+StressGCM Test.java

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGFPE (0x8) at pc=0x00007f601d1488d6, pid=4008, tid=4009
        #
        # JRE version: Java(TM) SE Runtime Environment (16.0) (slowdebug build 16-internal+0-2020-12-03-1109234.christian...)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 16-internal+0-2020-12-03-1109234.christian..., compiled mode, compressed oops, g1 gc, linux-amd64)
        # Problematic frame:
        # J 116 c2 Test.mainTest([Ljava/lang/String;)V (606 bytes) @ 0x00007f601d1488d6 [0x00007f601d148420+0x00000000000004b6]
        ...........
        Command Line: -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test -XX:+StressGCM --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main Test.java
        ...........
        Current thread (0x00007f60200284e0): JavaThread "main" [_thread_in_Java, id=4009, stack(0x00007f6029253000,0x00007f6029354000)]

        Stack: [0x00007f6029253000,0x00007f6029354000], sp=0x00007f6029351d80, free space=1019k
        Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
        J 116 c2 Test.mainTest([Ljava/lang/String;)V (606 bytes) @ 0x00007f601d1488d6 [0x00007f601d148420+0x00000000000004b6]
        J 85 c2 Test.main([Ljava/lang/String;)V (45 bytes) @ 0x00007f601d124be0 [0x00007f601d124b60+0x0000000000000080]
        v ~StubRoutines::call_stub
        V [libjvm.so+0xab587b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x59d
        V [libjvm.so+0xfa888e] os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x36
        V [libjvm.so+0xab52da] JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x8e
        V [libjvm.so+0x104f70e] invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*)+0xcbe
        V [libjvm.so+0x104fa61] Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0x191
        V [libjvm.so+0xbdd7d6] JVM_InvokeMethod+0x29f
        C [libjava.so+0x10737] Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0+0x43
        j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base
        j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+146 java.base
        j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base
        j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base
        j com.sun.tools.javac.launcher.Main.execute(Ljava/lang/String;[Ljava/lang/String;Lcom/sun/tools/javac/launcher/Main$Context;)V+128 jdk.compiler
        j com.sun.tools.javac.launcher.Main.run([Ljava/lang/String;[Ljava/lang/String;)V+54 jdk.compiler
        j com.sun.tools.javac.launcher.Main.main([Ljava/lang/String;)V+14 jdk.compiler
        v ~StubRoutines::call_stub
        V [libjvm.so+0xab587b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x59d
        V [libjvm.so+0xfa888e] os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x36
        V [libjvm.so+0xab52da] JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x8e
        V [libjvm.so+0xb5ee62] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x188
        V [libjvm.so+0xb74ab5] jni_CallStaticVoidMethod+0x333
        C [libjli.so+0x4d6d] JavaMain+0xbf7
        C [libjli.so+0xaf77] ThreadJavaMain+0x27


        siginfo: si_signo: 8 (SIGFPE), si_code: 1 (FPE_INTDIV), si_addr: 0x00007f601d1488d6

          Attachments

          1. FuzzerUtils.java
            13 kB
          2. hs_err_pid4008.log
            688 kB
          3. Test.java
            8 kB

            Issue Links

              Activity

                People

                Assignee:
                chagedorn Christian Hagedorn
                Reporter:
                chagedorn Christian Hagedorn
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: