RFR: 8342504: Remove NMT header and footer canaries [v3]

Johan Sjölen jsjolen at openjdk.org
Thu Feb 27 17:54:02 UTC 2025


On Thu, 20 Feb 2025 09:36:44 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Today NMT has two canaries: A header and a footer canary. These enable mainly two things:
>> 
>> 1. For NMT to aid in describing a pointer
>> 2. A basic form of out-of-bounds protection
>> 
>> With the introduction of UBSan and Asan into OpenJDK we have gained stronger tools for this sort of analysis, without requiring NMT to be activated. Therefore, I believe that point 2 is no longer something that NMT needs to support. For point number one, we will unfortunately be losing this ability.
>> 
>> I want to delete these canaries to open up a few free bytes. These can allow us to have "practically unlimited" (4 bytes) of memory tags.
>> 
>> tier1-tier2 tests succeeded.
>> 
>> I am awaiting discussion on the Hotspot-dev mailing list, but keeping this PR open for review.
>
> Johan Sjölen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
> 
>  - Merge remote-tracking branch 'openjdk/master' into delete-canaries
>  - Comment
>  - Rename flags to tags
>  - Remove canaries

Hi all,

As you might suspect, there is a reason that this PR is still open. I am also a bit unsure about removing this. The goal is to replace the two canary bytes in the header with 2 bytes for MemTags, and using the unused byte to gain a total of 4 bytes. One thing we can do is to replace only one of the canary bytes, to gain a total of 3 bytes for MemTags. A 3 byte MemTag would absolutely be sufficient for what we want.

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

PR Comment: https://git.openjdk.org/jdk/pull/21560#issuecomment-2688688245


More information about the hotspot-runtime-dev mailing list