RFR: 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP [v8]
Axel Boldt-Christmas
aboldtch at openjdk.org
Wed May 8 13:48:54 UTC 2024
On Wed, 8 May 2024 09:18:07 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)
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>
> Co-authored-by: Andrew Haley <aph-open at littlepinkcloud.com>
Looks good to me.
The ` // Increase loop counter by size of length field.` comments are not exactly true, unsure what to write instead.
-------------
Marked as reviewed by aboldtch (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18948#pullrequestreview-2045716594
More information about the hotspot-dev
mailing list