RFR: Only verify last object start for marked objects
William Kemper
wkemper at openjdk.java.net
Fri Dec 3 21:56:33 UTC 2021
On Fri, 3 Dec 2021 20:24:09 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> In some cases, verification could invoke `size` on an unmarked object resulting in a crash.
>
> src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.inline.hpp line 402:
>
>> 400: max_offset = CardTable::card_size_in_words;
>> 401: }
>> 402: size_t prev_offset = offset;
>
> Is this change motivated by a detected bug, or is this just a "style" improvement? It looks to me like this change is equivalent to the original code, because in both cases (when !ctx and ctx), we unconditionally set prev_offset to offset in the first iteration of the do-while loop.
Unconditionally setting prev_offset in the second branch (i.e., when `ctx` is not null) _is_ the bug. If the code there sets prev_offset to refer to refer to an _unmarked_ object, the following verification check to get the `size` on an unmarked object could crash. The intention here was to make sure that `prev_offset` never refers to an unmarked object, but this change isn't enough to guarantee that.
-------------
PR: https://git.openjdk.java.net/shenandoah/pull/103
More information about the shenandoah-dev
mailing list