RFR: 8330611: AES-CTR vector intrinsic may read out of bounds (x86_64, AVX-512)
Andrew Haley
aph at openjdk.org
Tue Apr 23 10:35:31 UTC 2024
On Fri, 19 Apr 2024 20:54:03 GMT, Smita Kamath <svkamath at openjdk.org> wrote:
> Hi, I've attached the alternative fix here. Please let me know if you have any questions. Thank you. [alternative-fix-8330611.txt](https://github.com/openjdk/jdk/files/15045540/alternative-fix-8330611.txt)
That looks nice, and is a good stylistic match for the rest of the code.
The comment should be here, though:
@@ -2614,8 +2615,11 @@ void StubGenerator::aesctr_encrypt(Register src_addr, Register dest_addr, Regist
__ bind(EXTRACT_TAILBYTES);
// Save encrypted counter value in xmm0 for next invocation, before XOR operation
__ movdqu(Address(saved_encCounter_start, 0), xmm0);
// XOR encryted block cipher in xmm0 with PT to produce CT
+ __ mov64(tail, -1L);
+ __ bzhiq(tail, tail, len_reg);
+ __ kmovql(k1, tail);
- __ evpxorq(xmm0, xmm0, Address(src_addr, pos, Address::times_1, 0), Assembler::AVX_128bit);
+ __ evpxorq(xmm0, k1, xmm0, Address(src_addr, pos, Address::times_1, 0), true, Assembler::AVX_128bit);
// extract up to 15 bytes of CT from xmm0 as specified by length register
__ testptr(len_reg, 8);
__ jcc(Assembler::zero, EXTRACT_TAIL_4BYTES);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18849#issuecomment-2071963021
More information about the hotspot-compiler-dev
mailing list