RFR: 8364198: NMT should have a better corruption message

Thomas Stuefe stuefe at openjdk.org
Tue Jul 29 09:21:59 UTC 2025


On Mon, 28 Jul 2025 23:40:18 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Makes sense. I am not sure about the "bug" part. Also, do we care about mentioning NMT at all? I think a useful template is GCC malloc:
>> 
>> 
>> *** glibc detected *** malloc(): memory corruption
>> 
>> 
>> Something like below would do, I think.
>> 
>> 
>> NMT detected memory corruption. Block at ...
>> 
>> 
>> ...or even:
>> 
>> 
>> Memory corruption detected. Block at ...
>
>> Also, do we care about mentioning NMT at all? 
> 
> We have to give credits to NMT for detecting an issue.

> @vnkozlov, it's unfortunately hard to add more info as the header (that which is 'corrupted') is also where we store what kind of allocation it is.

Well, you could do it on a best-effort base.

- if there is an overwrite of the block footer (which is the much more likely scenario with buffer overflows), the header could still be correct. Extract the _mst_marker from the header, decode the malloc site table entry, then print out the associated stack trace.
- even if the header is corrupted, one could still read the _mst_marker. If it seems to identify a malloc site table entry, one could print that one's stack trace with the addition "we think the original allocation may have originated from:"

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

PR Comment: https://git.openjdk.org/jdk/pull/26507#issuecomment-3131479757


More information about the hotspot-runtime-dev mailing list