Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] crypto, x86: aesni: add compatibility with IAS
@ 2020-06-22 23:24 Jian Cai
  2020-07-03  4:48 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Jian Cai @ 2020-06-22 23:24 UTC (permalink / raw)
  Cc: caij2003, jiancai, ndesaulniers, manojgupta, sedat.dilek,
	maskray, Herbert Xu, David S. Miller, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, linux-crypto,
	linux-kernel, clang-built-linux

Clang's integrated assembler complains "invalid reassignment of
non-absolute variable 'var_ddq_add'" while assembling
arch/x86/crypto/aes_ctrby8_avx-x86_64.S. It was because var_ddq_add was
reassigned with non-absolute values several times, which IAS did not
support. We can avoid the reassignment by replacing the uses of
var_ddq_add with its definitions accordingly to have compatilibility
with IAS.

Link: https://github.com/ClangBuiltLinux/linux/issues/1008
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Fangrui Song <maskray@google.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # build+boot Linux v5.7.5; clang v11.0.0-git
Signed-off-by: Jian Cai <caij2003@gmail.com>
---
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
index ec437db1fa54..494a3bda8487 100644
--- a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
+++ b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
@@ -127,10 +127,6 @@ ddq_add_8:
 
 /* generate a unique variable for ddq_add_x */
 
-.macro setddq n
-	var_ddq_add = ddq_add_\n
-.endm
-
 /* generate a unique variable for xmm register */
 .macro setxdata n
 	var_xdata = %xmm\n
@@ -140,9 +136,7 @@ ddq_add_8:
 
 .macro club name, id
 .altmacro
-	.if \name == DDQ_DATA
-		setddq %\id
-	.elseif \name == XDATA
+	.if \name == XDATA
 		setxdata %\id
 	.endif
 .noaltmacro
@@ -165,9 +159,8 @@ ddq_add_8:
 
 	.set i, 1
 	.rept (by - 1)
-		club DDQ_DATA, i
 		club XDATA, i
-		vpaddq	var_ddq_add(%rip), xcounter, var_xdata
+		vpaddq	(ddq_add_1 + 16 * (i - 1))(%rip), xcounter, var_xdata
 		vptest	ddq_low_msk(%rip), var_xdata
 		jnz 1f
 		vpaddq	ddq_high_add_1(%rip), var_xdata, var_xdata
@@ -180,8 +173,7 @@ ddq_add_8:
 	vmovdqa	1*16(p_keys), xkeyA
 
 	vpxor	xkey0, xdata0, xdata0
-	club DDQ_DATA, by
-	vpaddq	var_ddq_add(%rip), xcounter, xcounter
+	vpaddq	(ddq_add_1 + 16 * (by - 1))(%rip), xcounter, xcounter
 	vptest	ddq_low_msk(%rip), xcounter
 	jnz	1f
 	vpaddq	ddq_high_add_1(%rip), xcounter, xcounter
-- 
2.27.0.111.gc72c7da667-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto, x86: aesni: add compatibility with IAS
  2020-06-22 23:24 [PATCH] crypto, x86: aesni: add compatibility with IAS Jian Cai
@ 2020-07-03  4:48 ` Herbert Xu
  2020-07-03  8:36   ` Sedat Dilek
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2020-07-03  4:48 UTC (permalink / raw)
  To: Jian Cai
  Cc: jiancai, ndesaulniers, manojgupta, sedat.dilek, maskray,
	David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	x86, H. Peter Anvin, linux-crypto, linux-kernel,
	clang-built-linux

On Mon, Jun 22, 2020 at 04:24:33PM -0700, Jian Cai wrote:
> Clang's integrated assembler complains "invalid reassignment of
> non-absolute variable 'var_ddq_add'" while assembling
> arch/x86/crypto/aes_ctrby8_avx-x86_64.S. It was because var_ddq_add was
> reassigned with non-absolute values several times, which IAS did not
> support. We can avoid the reassignment by replacing the uses of
> var_ddq_add with its definitions accordingly to have compatilibility
> with IAS.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/1008
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Reported-by: Fangrui Song <maskray@google.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # build+boot Linux v5.7.5; clang v11.0.0-git
> Signed-off-by: Jian Cai <caij2003@gmail.com>
> ---
>  arch/x86/crypto/aes_ctrby8_avx-x86_64.S | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto, x86: aesni: add compatibility with IAS
  2020-07-03  4:48 ` Herbert Xu
@ 2020-07-03  8:36   ` Sedat Dilek
  2020-07-03 12:59     ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Sedat Dilek @ 2020-07-03  8:36 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Jian Cai, jiancai, Nick Desaulniers, manojgupta, maskray,
	David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	x86, H. Peter Anvin, linux-crypto, linux-kernel,
	Clang-Built-Linux ML

On Fri, Jul 3, 2020 at 6:49 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Mon, Jun 22, 2020 at 04:24:33PM -0700, Jian Cai wrote:
> > Clang's integrated assembler complains "invalid reassignment of
> > non-absolute variable 'var_ddq_add'" while assembling
> > arch/x86/crypto/aes_ctrby8_avx-x86_64.S. It was because var_ddq_add was
> > reassigned with non-absolute values several times, which IAS did not
> > support. We can avoid the reassignment by replacing the uses of
> > var_ddq_add with its definitions accordingly to have compatilibility
> > with IAS.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1008
> > Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Reported-by: Fangrui Song <maskray@google.com>
> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # build+boot Linux v5.7.5; clang v11.0.0-git
> > Signed-off-by: Jian Cai <caij2003@gmail.com>
> > ---
> >  arch/x86/crypto/aes_ctrby8_avx-x86_64.S | 14 +++-----------
> >  1 file changed, 3 insertions(+), 11 deletions(-)
>
> Patch applied.  Thanks.

Hi Herbert,

Can you please apply my patch, too?

For being able to compile/assemble with LLVM_IAS=1 *both* patches are
needed with CONFIG_CRYPTO_AES_NI_INTEL={m,y}.

If you do pick this up, please add a...

   Link: https://bugs.llvm.org/show_bug.cgi?id=24494

Thanks.

Regards,
- Sedat -

[0] https://lore.kernel.org/patchwork/patch/1263102/
[1] https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=44069737ac9625a0f02f0f7f5ab96aae4cd819bc
[2] https://bugs.llvm.org/show_bug.cgi?id=24494


> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto, x86: aesni: add compatibility with IAS
  2020-07-03  8:36   ` Sedat Dilek
@ 2020-07-03 12:59     ` Herbert Xu
  2020-07-03 14:33       ` Sedat Dilek
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2020-07-03 12:59 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Jian Cai, jiancai, Nick Desaulniers, manojgupta, maskray,
	David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	x86, H. Peter Anvin, linux-crypto, linux-kernel,
	Clang-Built-Linux ML

On Fri, Jul 03, 2020 at 10:36:43AM +0200, Sedat Dilek wrote:
>
> Can you please apply my patch, too?

Please repost your patch without the 5.7 tag.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto, x86: aesni: add compatibility with IAS
  2020-07-03 12:59     ` Herbert Xu
@ 2020-07-03 14:33       ` Sedat Dilek
  0 siblings, 0 replies; 5+ messages in thread
From: Sedat Dilek @ 2020-07-03 14:33 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Jian Cai, jiancai, Nick Desaulniers, manojgupta, maskray,
	David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	x86, H. Peter Anvin, linux-crypto, linux-kernel,
	Clang-Built-Linux ML

On Fri, Jul 3, 2020 at 3:00 PM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Fri, Jul 03, 2020 at 10:36:43AM +0200, Sedat Dilek wrote:
> >
> > Can you please apply my patch, too?
>
> Please repost your patch without the 5.7 tag.
>

Sent out a v5:

Changes v4->v5:
- Drop "5.7" tag from subject line as requested by Herbert Xu
- Add Link to LLVM bug #24494 (thanks Nick)

Thanks.

- Sedat -

> Thanks,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200703125949.GA28373%40gondor.apana.org.au.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 23:24 [PATCH] crypto, x86: aesni: add compatibility with IAS Jian Cai
2020-07-03  4:48 ` Herbert Xu
2020-07-03  8:36   ` Sedat Dilek
2020-07-03 12:59     ` Herbert Xu
2020-07-03 14:33       ` Sedat Dilek

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git