Integrated: 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP

Roman Kennke rkennke at openjdk.org
Fri May 10 21:16:26 UTC 2024


On Thu, 25 Apr 2024 10:38:55 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> The implementations of Arrays.equals() in macroAssembler_aarch64.cpp, MacroAssembler::arrays_equals() assumes that the start of arrays is 8-byte-aligned. Since [JDK-8139457](https://bugs.openjdk.org/browse/JDK-8139457) this is no longer the case, at least when running with -CompressedClassPointers (or Lilliput). The effect is that the loops may run over the array end, and if the array is at heap boundary, and that memory is unmapped, then it may crash.
> 
> The proposed fix aims to always enter the main loop(s) with an aligned address:
>  - When the array base is 8-byte-aligned (default, with +CCP), then compare the array lengths separately, then enter the main loop with the array base.
>  - When the array base is not 8-byte-aligned (-CCP and Lilliput), then enter the loop with the address of the array-length (which is then 8-byte-aligned), and compare array lengths in the main loop, and elide the explicit array lengths comparison.
> 
> Testing:
>  - [x] tier1 (+CCP)
>  - [x] tier1 (-CCP)
>  - [x] tier2 (+CCP)
>  - [x] tier2 (-CCP)

This pull request has now been integrated.

Changeset: 1dac34fa
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1dac34fa757f1d603f0bc9b9c1994c114c276add
Stats:     32 lines in 1 file changed: 13 ins; 9 del; 10 mod

8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP

Reviewed-by: aboldtch, aph

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

PR: https://git.openjdk.org/jdk/pull/18948


More information about the hotspot-dev mailing list