RFR: JDK-8289633: Forbid raw C-heap allocation functions in hotspot and fix findings [v2]
Thomas Stuefe
stuefe at openjdk.org
Mon Jul 4 07:26:38 UTC 2022
On Sun, 3 Jul 2022 13:08:24 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Thomas Stuefe has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Forgot one..
>> - Review feedback Kim
>
> src/hotspot/cpu/ppc/macroAssembler_ppc_sha.cpp line 28:
>
>> 26: #ifdef AIX
>> 27: #include "runtime/os.hpp" // malloc
>> 28: #endif
>
> Is it actually important to make the inclusion conditional? Also, the Style Guide says conditional includes go at the end.
No, its not. I removed it.
> src/hotspot/share/runtime/os.cpp line 739:
>
>> 737: void* const old_outer_ptr = MemTracker::record_free(memblock);
>> 738:
>> 739: ALLOW_C_FUNCTION(::realloc, ::free(old_outer_ptr);)
>
> s/realloc/free/ - unfortunately, the existing macro implementations only use the name for "documentation" purposes.
Fixed
> src/hotspot/share/utilities/globalDefinitions.hpp line 178:
>
>> 176: FORBID_C_FUNCTION(void free(void *ptr), "use os::free");
>> 177: FORBID_C_FUNCTION(void* realloc(void *ptr, size_t size), "use os::realloc");
>> 178: FORBID_C_FUNCTION(char* strdup(const char *s), "use os::realloc");
>
> s/realloc/strdup/
Right
-------------
PR: https://git.openjdk.org/jdk/pull/9356
More information about the hotspot-dev
mailing list