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

Thomas Stuefe stuefe at openjdk.org
Wed Oct 26 06:38:30 UTC 2022


On Wed, 26 Oct 2022 05:54:23 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   assert overflows (debug+release)
>
> 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.

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

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


More information about the hotspot-runtime-dev mailing list