RFR: 8342504: Remove NMT header and footer canaries

Afshin Zafari azafari at openjdk.org
Mon Nov 18 10:53:51 UTC 2024


On Thu, 17 Oct 2024 10:04:16 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.

src/hotspot/share/nmt/mallocHeader.hpp line 63:

> 61:  *           8        9        10       11       12       13       14       15          16 ++
> 62:  *       +--------+--------+--------+--------+--------+--------+--------+--------+  ------------------------
> 63:  *  ...  |   malloc site table marker        | flags  |         unused           |  ... User payload ....

flags -> Memory Tags

src/hotspot/share/nmt/mallocHeader.hpp line 75:

> 73:  *           8        9        10       11       12       13       14       15          16 ++
> 74:  *       +--------+--------+--------+--------+--------+--------+--------+--------+  ------------------------
> 75:  *  ...  |   malloc site table marker        | flags  |          unused          |  ... User payload ....

flags -> Memory Tags

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21560#discussion_r1846365489
PR Review Comment: https://git.openjdk.org/jdk/pull/21560#discussion_r1846365979


More information about the hotspot-runtime-dev mailing list