RFR: 8369393: NMT: poison the malloc header and footer under ASAN build [v2]
Afshin Zafari
azafari at openjdk.org
Wed Dec 17 09:02:28 UTC 2025
On Wed, 3 Dec 2025 14:11:08 GMT, Paul Hübner <phubner at openjdk.org> wrote:
>> Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>>
>> - Merge remote-tracking branch 'origin/master' into asan_poison_malloc_hdr_ftr_v2
>> - removed extra newlines.
>> - fixes.
>> - inlining
>> - review comments applied.
>> - revision
>> - jtreg test excluded when ASAN is enabled.
>> - 8369393: NMT: poison the malloc header and footer under ASAN build
>
> src/hotspot/share/nmt/mallocHeader.inline.hpp line 170:
>
>> 168: ASAN_UNPOISON_MEMORY_REGION(header->footer_address(), footer_size);
>> 169: resolve_checked(memblock);
>> 170: header->mark_block_as_dead();
>
> Unrelated to this PR: is there a reason we `mark_block_as_dead()` but `revive()` as opposed to `mark_block_as_revived()`?
I prefer `mark_block_as_alive()` with no assertion on being already `dead`. `revive()` with assertion that it has to be `dead` already. Thoughts?
> src/hotspot/share/runtime/os.cpp line 724:
>
>> 722: void* const new_outer_ptr = permit_forbidden_function::realloc(header, new_outer_size);
>> 723: bool realloc_succeeded = new_outer_ptr != nullptr;
>> 724: success = realloc_succeeded;
>
> Nit: `realloc_succeeded` is only used here. Got briefly confused why there were two successes while reviewing.
> Suggestion:
>
> success = new_outer_ptr != nullptr; // reallocation succeeded
Suggestion accepted.
> src/hotspot/share/runtime/os.cpp line 739:
>
>> 737: #endif
>> 738:
>> 739: success = true;
>
> Redundant assignment?
Good catch! removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28503#discussion_r2585403118
PR Review Comment: https://git.openjdk.org/jdk/pull/28503#discussion_r2585406002
PR Review Comment: https://git.openjdk.org/jdk/pull/28503#discussion_r2585402949
More information about the hotspot-runtime-dev
mailing list