[lilliput-jdk17u:lilliput] Integrated: 8310662: [Lilliput/JDK17] Fix OptoRuntime::new_array_nozero_C

Roman Kennke rkennke at openjdk.org
Thu Jun 22 21:21:39 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 pull request has now been integrated.

Changeset: b575b53c
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.org/lilliput-jdk17u/commit/b575b53c84361ff47fc03c720be46dc6e63e4f01
Stats:     9 lines in 1 file changed: 3 ins; 1 del; 5 mod

8310662: [Lilliput/JDK17] Fix OptoRuntime::new_array_nozero_C

Reviewed-by: shade

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

PR: https://git.openjdk.org/lilliput-jdk17u/pull/43


More information about the lilliput-dev mailing list