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

Johan Sjölen jsjolen at openjdk.org
Mon Nov 10 08:24:07 UTC 2025


On Fri, 7 Nov 2025 10:06:46 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> NMT can detect malloc'd memory corruption using canary tests at header and footer of every memory region. This can only be done at free time of the memory where NNT checks the canaries and report error if they are not as expected.
>> In this PR, the canary parts also are poisoned using ASAN API to get notified whenever a read/write op is done. on the canary parts. `_size` member of the malloc header is also poisoned, since it is used for finding the footer address.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixes after merge.

Marked as reviewed by jsjolen (Reviewer).

test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp line 33:

> 31: #include "utilities/ostream.hpp"
> 32: #include "unittest.hpp"
> 33: #include "testutils.hpp"

I think our style dictates that this change should be reverted.

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

PR Review: https://git.openjdk.org/jdk/pull/27685#pullrequestreview-3441497591
PR Review Comment: https://git.openjdk.org/jdk/pull/27685#discussion_r2509233975


More information about the hotspot-runtime-dev mailing list