Skip to content

Commit

Permalink
8333887: ubsan: unsafe.cpp:247:13: runtime error: store to null point…
Browse files Browse the repository at this point in the history
…er of type 'volatile int'

Reviewed-by: lucy, mdoerr
  • Loading branch information
MBaesken committed Jun 13, 2024
1 parent 9d8439c commit 0d3a377
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hotspot/share/prims/unsafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ class MemoryAccess : StackObj {
return normalize_for_read(*addr());
}

// 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
void put(T x) {
GuardUnsafeAccess guard(_thread);
*addr() = normalize_for_write(x);
Expand Down

1 comment on commit 0d3a377

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.