RFR: JDK-8295889: NMT preinit code does not handle allocation errors [v2]

David Holmes dholmes at openjdk.org
Wed Oct 26 07:34:27 UTC 2022


On Wed, 26 Oct 2022 06:35:55 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/services/nmtPreInit.cpp line 55:
>> 
>>> 53: NMTPreInitAllocation* NMTPreInitAllocation::do_alloc(size_t payload_size) {
>>> 54:   const size_t outer_size = sizeof(NMTPreInitAllocation) + payload_size;
>>> 55:   guarantee(outer_size > payload_size, "Overflow");
>> 
>> I was suggesting an assertion as this is a VM programming error we should catch during testing in't it?
>
> Guarantee as a protection against future bitrot. I am not even 100% sure there are not paths today that are controlled via outside input. I am even less sure about the future. Therefore I protect the release version too. Are you concerned about runtime costs? It is just a comparison.
> 
> OTOH I have no strong emotions here. If you insist, I can make it debug only.

I'm more concerned that we don't know if this path may be influenced by external input. :(

These kind of "just in case" checks all add up.

But I won't insist on a change.

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

PR: https://git.openjdk.org/jdk/pull/10855


More information about the hotspot-runtime-dev mailing list