mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8298293: NMT: os::realloc() should verify that flags do not change between reallocations
Reviewed-by: dholmes, stuefe, iklam
This commit is contained in:
parent
101db262e1
commit
c37e9d1c8d
3 changed files with 8 additions and 6 deletions
|
@ -694,7 +694,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
|||
|
||||
// Special handling for NMT preinit phase before arguments are parsed
|
||||
void* rc = nullptr;
|
||||
if (NMTPreInit::handle_realloc(&rc, memblock, size)) {
|
||||
if (NMTPreInit::handle_realloc(&rc, memblock, size, memflags)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -727,6 +727,8 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
|
|||
// Perform integrity checks on and mark the old block as dead *before* calling the real realloc(3) since it
|
||||
// may invalidate the old block, including its header.
|
||||
MallocHeader* header = MallocHeader::resolve_checked(memblock);
|
||||
assert(memflags == header->flags(), "weird NMT flags mismatch (new:\"%s\" != old:\"%s\")\n",
|
||||
NMTUtil::flag_to_name(memflags), NMTUtil::flag_to_name(header->flags()));
|
||||
const MallocHeader::FreeInfo free_info = header->free_info();
|
||||
header->mark_block_as_dead();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue