-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8333887: ubsan: unsafe.cpp:247:13: runtime error: store to null pointer of type 'volatile int' #19630
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
@MBaesken This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 47 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
// we use this method at some places for writing to 0 e.g. to cause a crash; | ||
// ubsan does not know that this is the desired behavior | ||
#if defined(__clang__) || defined(__GNUC__) | ||
__attribute__((no_sanitize("undefined"))) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we hide this in a macro like SUPPRESS_UBSAN_WARNING
? If it turns out we need to do this in a few places then it will look nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea. See also the discussion about ATTRIBUTE_NO_UBSAN
here #19597
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of an encapsulating macro as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess ATTRIBUTE_NO_UBSAN will do if we have a precedent for that naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Hi Lutz, thanks for the review ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me if you do the macro thing later.
Thanks for the reviews ! The 'macro thing' comes in a follow up. /integrate |
Going to push as commit 0d3a377.
Your commit was automatically rebased without conflicts. |
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::put(int) src/hotspot/share/prims/unsafe.cpp:247
#1 0x7f0be9a3e10d in Unsafe_PutInt src/hotspot/share/prims/unsafe.cpp:315
#2 0x7f0bd0502e7b ()
#3 0x7f0bd04fe01f ()
#4 0x7f0bd04fe01f ()
#5 0x7f0bd04fe525 ()
#6 0x7f0bd04f6c85 ()
#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).
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19630/head:pull/19630
$ git checkout pull/19630
Update a local copy of the PR:
$ git checkout pull/19630
$ git pull https://git.openjdk.org/jdk.git pull/19630/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19630
View PR using the GUI difftool:
$ git pr show -t 19630
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19630.diff
Webrev
Link to Webrev Comment