2023-05-16 18:19:17

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH] crypto: x86/aria - Use 16 byte alignment for GFNI constant vectors

The GFNI routines in the AVX version of the ARIA implementation now use
explicit VMOVDQA instructions to load the constant input vectors, which
means they must be 16 byte aligned. So ensure that this is the case, by
dropping the section split and the incorrect .align 8 directive, and
emitting the constants into the 16-byte aligned section instead.

Note that the AVX2 version of this code deviates from this pattern, and
does not require a similar fix, given that it loads these contants as
8-byte memory operands, for which AVX2 permits any alignment.

Cc: Taehee Yoo <[email protected]>
Fixes: 8b84475318641c2b ("crypto: x86/aria-avx - Do not use avx2 instructions")
Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Ard Biesheuvel <[email protected]>
---
arch/x86/crypto/aria-aesni-avx-asm_64.S | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/x86/crypto/aria-aesni-avx-asm_64.S b/arch/x86/crypto/aria-aesni-avx-asm_64.S
index 7c1abc513f34621e..9556dacd984154a2 100644
--- a/arch/x86/crypto/aria-aesni-avx-asm_64.S
+++ b/arch/x86/crypto/aria-aesni-avx-asm_64.S
@@ -773,8 +773,6 @@
.octa 0x3F893781E95FE1576CDA64D2BA0CB204

#ifdef CONFIG_AS_GFNI
-.section .rodata.cst8, "aM", @progbits, 8
-.align 8
/* AES affine: */
#define tf_aff_const BV8(1, 1, 0, 0, 0, 1, 1, 0)
.Ltf_aff_bitmatrix:
--
2.39.2



2023-05-24 10:28:06

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: x86/aria - Use 16 byte alignment for GFNI constant vectors

On Tue, May 16, 2023 at 08:14:19PM +0200, Ard Biesheuvel wrote:
> The GFNI routines in the AVX version of the ARIA implementation now use
> explicit VMOVDQA instructions to load the constant input vectors, which
> means they must be 16 byte aligned. So ensure that this is the case, by
> dropping the section split and the incorrect .align 8 directive, and
> emitting the constants into the 16-byte aligned section instead.
>
> Note that the AVX2 version of this code deviates from this pattern, and
> does not require a similar fix, given that it loads these contants as
> 8-byte memory operands, for which AVX2 permits any alignment.
>
> Cc: Taehee Yoo <[email protected]>
> Fixes: 8b84475318641c2b ("crypto: x86/aria-avx - Do not use avx2 instructions")
> Reported-by: [email protected]
> Tested-by: [email protected]
> Signed-off-by: Ard Biesheuvel <[email protected]>
> ---
> arch/x86/crypto/aria-aesni-avx-asm_64.S | 2 --
> 1 file changed, 2 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt