RFR: FileMapInfo::write_bitmap_region after premain merge

Aleksey Shipilev shade at openjdk.org
Fri Sep 27 08:07:20 UTC 2024


I think there is a bad merge in `FileMapInfo::write_bitmap_region`.

The symptom on `runtime/cds` tests suggests we have have the overflow on `bitmap` buffer array we have just allocated, which suggests we miscalculated the size for it:


#  Internal Error (/home/shade/trunks/shipilev-leyden/src/hotspot/share/nmt/mallocHeader.inline.hpp:107), pid=2332848, tid=2332849
#  fatal error: NMT corruption: Block at 0x000078422d0c3120: footer canary broken at 0x000078422d0f8618 (buffer overflow?)

Stack: [0x0000784232100000,0x0000784232200000],  sp=0x00007842321fcfe0,  free space=1011k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x145e785]  MallocHeader* MallocHeader::resolve_checked_impl<void*, MallocHeader*>(void*)+0x145  (mallocHeader.inline.hpp:107)
V  [libjvm.so+0x145d599]  MallocTracker::record_free_block(void*)+0x29  (mallocHeader.inline.hpp:113)
V  [libjvm.so+0x15dc42a]  os::free(void*)+0x6a  (memTracker.hpp:94)
V  [libjvm.so+0x64a487]  ArchiveBuilder::write_archive(FileMapInfo*, ArchiveHeapInfo*)+0x457  (archiveBuilder.cpp:1569)
V  [libjvm.so+0x14d3ece]  MetaspaceShared::write_static_archive(ArchiveBuilder*, FileMapInfo*, ArchiveHeapInfo*)+0x4e  (metaspaceShared.cpp:1016)
V  [libjvm.so+0x14d9066]  MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder&, JavaThread*)+0x5c6  (metaspaceShared.cpp:999)
V  [libjvm.so+0x14d9217]  MetaspaceShared::preload_and_dump(JavaThread*)+0x87  (metaspaceShared.cpp:792)
V  [libjvm.so+0x1a4cd3c]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x122c  (threads.cpp:909)
V  [libjvm.so+0x1078e78]  JNI_CreateJavaVM+0x58  (jni.cpp:3594)
C  [libjli.so+0x4903]  JavaMain+0x93  (java.c:1494)
C  [libjli.so+0x7f0d]  ThreadJavaMain+0xd  (java_md.c:633)


Additional testing:
 - [x] Linux x86_64 server fastdebug, `runtime/cds` now passes

-------------

Commit messages:
 - Fix

Changes: https://git.openjdk.org/leyden/pull/24/files
  Webrev: https://webrevs.openjdk.org/?repo=leyden&pr=24&range=00
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/leyden/pull/24.diff
  Fetch: git fetch https://git.openjdk.org/leyden.git pull/24/head:pull/24

PR: https://git.openjdk.org/leyden/pull/24


More information about the leyden-dev mailing list