RFR: 8369393: NMT: poison the canaries of malloc header under ASAN build [v2]
Afshin Zafari
azafari at openjdk.org
Wed Oct 8 12:47:40 UTC 2025
On Wed, 8 Oct 2025 12:05:56 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>>
>> include sort
>
> src/hotspot/share/nmt/mallocHeader.hpp line 142:
>
>> 140: footer_address()[0] = (uint8_t)(v >> 8); footer_address()[1] = (uint8_t)v;
>> 141: }
>> 142: #endif
>
> I'd prefer the following. Then we keep the simple definitions separate and as small as previously.
>
> ```c++
> #if INCLUDE_ASAN
> // Insert your defs here.
> #else
> uint8_t* footer_address() const { return ((address)this) + sizeof(MallocHeader) + _size; }
> uint16_t get_footer() const { return build_footer(footer_address()[0], footer_address()[1]); }
> void set_footer(uint16_t v) { footer_address()[0] = (uint8_t)(v >> 8); footer_address()[1] = (uint8_t)v; }
> #endif
Done.
> src/hotspot/share/nmt/mallocHeader.hpp line 191:
>
>> 189: inline bool is_poisoned() const { return false; }
>> 190: inline void set_poisoned(bool poison) { }
>> 191: #endif
>
> Please do the same type of separation that I suggested above.
Done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27685#discussion_r2413737076
PR Review Comment: https://git.openjdk.org/jdk/pull/27685#discussion_r2413736531
More information about the hotspot-runtime-dev
mailing list