RFR: 8266787: Potential overflow of pointer arithmetic in G1ArchiveAllocator

Kim Barrett kbarrett at openjdk.java.net
Sun May 9 19:14:05 UTC 2021


On Sat, 8 May 2021 19:41:44 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Identified during the review of #3900. Using `pointer_delta` to fix the issue and some general cleanup.

src/hotspot/share/gc/g1/g1Allocator.cpp line 477:

> 475:     if (_max != _allocation_region->end()) {
> 476:       // Shift to the next chunk
> 477:       old_top = _bottom = _max;

Why is this line being moved?  It seems otherwise unrelated to the CR change.  With this change, if `alloc_new_region` fails then `_bottom` is no longer updated; is that okay?  I spent a little time investigating, but haven't yet found anything convincing either way.

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

PR: https://git.openjdk.java.net/jdk/pull/3936



More information about the hotspot-gc-dev mailing list