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

ubsan: unsafe.cpp:247:13: runtime error: store to null pointer of type 'volatile int'

XMLWordPrintable

    • b03
    • generic
    • linux

        When running with ubsan enabled binaries, in a number of tests like
        jdk/jfr/event/runtime/TestShutdownEvent.jtr
        jdk/jfr/jvm/TestDumpOnCrash.jtr
        we get those ubsan-errors :

        src/hotspot/share/prims/unsafe.cpp:247:13: runtime error: store to null pointer of type 'volatile int'
            #0 0x7f0be9a3e10d in MemoryAccess<int>::put(int) src/hotspot/share/prims/unsafe.cpp:247
            #1 0x7f0be9a3e10d in Unsafe_PutInt src/hotspot/share/prims/unsafe.cpp:315
            #2 0x7f0bd0502e7b (<unknown module>)
            #3 0x7f0bd04fe01f (<unknown module>)
            #4 0x7f0bd04fe01f (<unknown module>)
            #5 0x7f0bd04fe525 (<unknown module>)
            #6 0x7f0bd04f6c85 (<unknown module>)
            #7 0x7f0be80a2972 in JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*) src/hotspot/share/runtime/javaCalls.cpp:415
            #8 0x7f0be83160d8 in jni_invoke_static src/hotspot/share/prims/jni.cpp:888
            #9 0x7f0be831d875 in jni_CallStaticVoidMethod src/hotspot/share/prims/jni.cpp:1717
            #10 0x7f0beed32cf8 in invokeStaticMainWithArgs src/java.base/share/native/libjli/java.c:418
            #11 0x7f0beed35894 in JavaMain src/java.base/share/native/libjli/java.c:623
            #12 0x7f0beed3cf68 in ThreadJavaMain src/java.base/unix/native/libjli/java_md.c:653
            #13 0x7f0beeceb6e9 in start_thread (/lib64/libpthread.so.0+0xa6e9) (BuildId: 2f8d3c2d0f4d7888c2598d2ff6356537f5708a73)

        Looks like we use unsafe to put/write to 0 e.g. to cause a crash. Probably we could add an attribute to the function so that ubsan stops complaining (the put to 0 is done for a reason but ubsan cannot know this).

              mbaesken Matthias Baesken
              mbaesken Matthias Baesken
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: