RFR: 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP
Roman Kennke
rkennke at openjdk.org
Thu Apr 25 10:43:51 UTC 2024
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:
- [ ] tier1 (+CCP)
- [ ] tier1 (-CCP)
- [ ] tier2 (+CCP)
- [ ] tier2 (-CCP)
-------------
Commit messages:
- 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP
Changes: https://git.openjdk.org/jdk/pull/18948/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18948&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8331098
Stats: 62 lines in 1 file changed: 46 ins; 0 del; 16 mod
Patch: https://git.openjdk.org/jdk/pull/18948.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18948/head:pull/18948
PR: https://git.openjdk.org/jdk/pull/18948
More information about the hotspot-dev
mailing list