RFR: 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP [v2]
Roman Kennke
rkennke at openjdk.org
Thu Apr 25 11:50:52 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)
Roman Kennke has updated the pull request incrementally with two additional commits since the last revision:
- Remove excess whitespace
- Avoid loading cnt2 on paths that don't need it
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/18948/files
- new: https://git.openjdk.org/jdk/pull/18948/files/a59e11ee..68fe9ca2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18948&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18948&range=00-01
Stats: 8 lines in 1 file changed: 4 ins; 1 del; 3 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