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

Roman Kennke rkennke at openjdk.org
Thu Jun 22 16:14:37 UTC 2023


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.

Two 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) ?

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

Commit messages:
 - 8310662: [Lilliput/JDK17] Fix OptoRuntime::new_array_nozero_C

Changes: https://git.openjdk.org/lilliput-jdk17u/pull/43/files
 Webrev: https://webrevs.openjdk.org/?repo=lilliput-jdk17u&pr=43&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8310662
  Stats: 9 lines in 1 file changed: 3 ins; 1 del; 5 mod
  Patch: https://git.openjdk.org/lilliput-jdk17u/pull/43.diff
  Fetch: git fetch https://git.openjdk.org/lilliput-jdk17u.git pull/43/head:pull/43

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


More information about the lilliput-dev mailing list