JDK-8239787 : AArch64: String.indexOf may incorrectly handle empty strings

Alexey Bakhtin alexey at azul.com
Thu Feb 27 11:29:02 UTC 2020


Hello Andrew,

Can we commit this fix into JDK15 and set backport flags to JDK9 and higher?
As soon as it is simple fix and applied cleanly to all JDK versions (starting from JDK9) we can backport it to all applicable versions as well.

Thank you
Alexey

> On 27 Feb 2020, at 13:42, Alexey Bakhtin <alexey at azul.com> wrote:
> 
> Hello Andrew,
> 
> Thank you for review.
> string_indexof_char intrinsic for aarch64 was introduced in JDK9 ( JDK-8157708 ), so this patch is applicable to JDK9 and higher.
> JDK8 does not support string_indexof_char intrinsic, so does not have this issue.
> 
> Thank you
> Alexey
> 
>> On 26 Feb 2020, at 20:39, Andrew Haley <aph at redhat.com> wrote:
>> 
>> Hi,
>> 
>> On 2/26/20 12:51 PM, Alexey Bakhtin wrote:
>>> Could you please review fix for aarch64 related issue:  https://bugs.openjdk.java.net/browse/JDK-8239787
>>> 
>>> The fix verifies length of the string at the beginning of string_indexof_char intrinsic code :
>>> 
>>> diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>>> b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>>> --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>>> +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
>>> @@ -4860,6 +4860,8 @@
>>>  Register ch1 = rscratch1;
>>>  Register result_tmp = rscratch2;
>>> 
>>> + cbz(cnt1, NOMATCH);
>>> +
>>>  cmp(cnt1, (u1)4);
>>>  br(LT, DO1_SHORT);
>> 
>> Looks good, thanks. Can you please have a look at JDK 8u and 11u, to see
>> if the bug is there too? Then we can set backport flags.
>> 
>> The 8u repo is at
>> http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/hotspot/
>> 
>> --
>> Andrew Haley  (he/him)
>> Java Platform Lead Engineer
>> Red Hat UK Ltd. <https://www.redhat.com>
>> https://keybase.io/andrewhaley
>> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the jdk-dev mailing list