RFR: 8361043: [ubsan] os::print_hex_dump runtime error: applying non-zero offset 8 to null pointer
Lutz Schmidt
lucy at openjdk.org
Mon Jun 30 16:05:38 UTC 2025
On Mon, 30 Jun 2025 07:49:45 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> When running jtreg test
> runtime/cds/DeterministicDump
> with ubsan-enabled binaries (opt) on macOS aarch64, the following issue is reported :
>
>
> /jdk/src/hotspot/share/runtime/os.cpp:1045:15: runtime error: applying non-zero offset 8 to null pointer
> #0 0x106156ad4 in os::print_hex_dump(outputStream*, unsigned char const*, unsigned char const*, int, bool, int, unsigned char const*, unsigned char const*) os.cpp:1045
> #1 0x10524685c in ArchiveBuilder::CDSMapLogger::log(ArchiveBuilder*, FileMapInfo*, ArchiveHeapInfo*, char*, unsigned long) archiveBuilder.cpp:1573
> #2 0x105245e60 in ArchiveBuilder::write_archive(FileMapInfo*, ArchiveHeapInfo*) archiveBuilder.cpp:1634
> #3 0x106084fd4 in MetaspaceShared::write_static_archive(ArchiveBuilder*, FileMapInfo*, ArchiveHeapInfo*) metaspaceShared.cpp:1053
> #4 0x10608411c in MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder&, JavaThread*) metaspaceShared.cpp:1030
> #5 0x1060837b8 in MetaspaceShared::preload_and_dump(JavaThread*) metaspaceShared.cpp:812
> #6 0x10660457c in Threads::create_vm(JavaVMInitArgs*, bool*) threads.cpp:892
> #7 0x105ca60dc in JNI_CreateJavaVM jni.cpp:3680
> #8 0x100fbe4d0 in JavaMain java.c:494
> #9 0x100fc54fc in ThreadJavaMain java_md_macosx.m:679
> #10 0x197372f90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
> #11 0x19736dd30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)
LGTM.
David's (@dholmes-ora) comment touches a widespread inconsistency. Historically, almost nobody cared about distinguishing between naturally signed and unsigned entities.
A clean solution would be to declare `unitsize` as `unsigned int` and adapt all callers. I'm not sure if widening the scope of this otherwise trivial change is justified.
-------------
Marked as reviewed by lucy (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26037#pullrequestreview-2971842726
More information about the hotspot-runtime-dev
mailing list