RFR: 8306561: Possible out of bounds access in print_pointer_information [v5]

Thomas Obermeier duke at openjdk.org
Tue Oct 31 17:28:01 UTC 2023


On Sat, 28 Oct 2023 06:23:35 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/nmt/mallocTracker.cpp line 215:
>> 
>>> 213:     for (; here >= end; here -= smallest_possible_alignment) {
>>> 214:       // JDK-8306561: cast to a MallocHeader needs to guarantee it can reside in readable memory
>>> 215:       if (!os::is_readable_pointer(here) || !os::is_readable_pointer(here + sizeof(MallocHeader) - 1)) {
>> 
>> Would os::is_readable_range be the better choice here?
>
> That would work too.

I agree; although it effectively does the same here, this matches the idea to check the whole region before casting to it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16381#discussion_r1377937131


More information about the hotspot-dev mailing list