[lilliput-jdk17u:lilliput] RFR: 8310662: [Lilliput/JDK17] Fix OptoRuntime::new_array_nozero_C
Aleksey Shipilev
shade at openjdk.org
Thu Jun 22 18:26:35 UTC 2023
On Thu, 22 Jun 2023 16:07:51 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> There's a severe bug in OptoRuntime::new_array_nozero_C() where we could end up clearing other memory because we add a byte-sized offset to a pointer base:
>
>
> HeapWord* obj = cast_from_oop<HeapWord*>(result);
> if (aligned_hs_bytes > hs_bytes) {
> Copy::zero_to_bytes(obj + hs_bytes, aligned_hs_bytes - hs_bytes);
> }
>
>
> This PR brings us to the same state as the proposed upstreaming PR https://github.com/openjdk/jdk/pull/11044 currently has.
>
> Three possible improvements to this PR:
> - Is it even worth clearing the unaligned head? Could we use Copy::fill_to_bytes() instead, and rely on that routine to do the split?
> - Should we guard the paths with if (UCOH) ?
> - I'm trying to come up with a reproducer, because that problem doesn't seem to have been caught by tests.
This looks fine on its own, and by the symmetry with upstream PR.
Not sure how can we protect this with `UCOH`?
-------------
Marked as reviewed by shade (Reviewer).
PR Review: https://git.openjdk.org/lilliput-jdk17u/pull/43#pullrequestreview-1493778087
More information about the lilliput-dev
mailing list