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

Johan Sjölen jsjolen at openjdk.org
Thu Oct 16 07:56:21 UTC 2025


On Wed, 15 Oct 2025 11:37:57 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 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 16 additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into _20251006_asan_hdr_footer
>  - include order
>  - clean ups
>  - another NOT_LP64
>  - NOT_LP64 code fix
>  - register_memory -> poison_memory
>  - reviews applied
>  - better style
>  - a step back
>  - alternative impl
>  - ... and 6 more: https://git.openjdk.org/jdk/compare/4e89bd3f...2b143527

As you say, I think it's good to have this as a more general tool in the ASAN support source file.

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

Changes requested by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27685#pullrequestreview-3339830605


More information about the hotspot-runtime-dev mailing list