RFR: 8369393: NMT: poison the canaries of malloc header under ASAN build [v20]

Afshin Zafari azafari at openjdk.org
Mon Nov 10 19:06:57 UTC 2025


On Mon, 10 Nov 2025 12:16:14 GMT, Paul Hübner <phubner at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   order of includes corrected.
>
> src/hotspot/share/nmt/mallocHeader.inline.hpp line 63:
> 
>> 61:   asan_unpoison_self();
>> 62:   set_header_canary(_header_canary_dead_mark);
>> 63:   NOT_LP64(set_alt_canary(_header_alt_canary_dead_mark);)
> 
> Question: is there a reason why the canaries and alt canaries are set here rather than in the unpoison function? While reviewing I had to jump back and forth between this & the other method to figure out what's going on.

Consider the logic here that when ASAN is not enabled, the malloc-header functionality should proceed. i.e. the canaries to be set as DEAD. When the ASAN is enabled, however, the memory regions for the canaries should be unpoisoned otherwise ASAN assertions raise (since we are writing to poisoned memory region).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27685#discussion_r2511650981


More information about the hotspot-runtime-dev mailing list