llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: sm4 - Do not change section of ck and sbox
@ 2021-08-25 20:38 Nathan Chancellor
  2021-08-26  6:25 ` Tianjia Zhang
  2021-09-17  3:18 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-08-25 20:38 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, Tianjia Zhang, Nick Desaulniers, linux-crypto,
	linux-kernel, clang-built-linux, llvm, Nathan Chancellor

When building with clang and GNU as, there is a warning about ignored
changed section attributes:

/tmp/sm4-c916c8.s: Assembler messages:
/tmp/sm4-c916c8.s:677: Warning: ignoring changed section attributes for
.data..cacheline_aligned

"static const" places the data in .rodata but __cacheline_aligned has
the section attribute to place it in .data..cacheline_aligned, in
addition to the aligned attribute.

To keep the alignment but avoid attempting to change sections, use the
____cacheline_aligned attribute, which is just the aligned attribute.

Fixes: 2b31277af577 ("crypto: sm4 - create SM4 library based on sm4 generic code")
Link: https://github.com/ClangBuiltLinux/linux/issues/1441
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 lib/crypto/sm4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/crypto/sm4.c b/lib/crypto/sm4.c
index 633b59fed9db..284e62576d0c 100644
--- a/lib/crypto/sm4.c
+++ b/lib/crypto/sm4.c
@@ -15,7 +15,7 @@ static const u32 fk[4] = {
 	0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc
 };
 
-static const u32 __cacheline_aligned ck[32] = {
+static const u32 ____cacheline_aligned ck[32] = {
 	0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
 	0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
 	0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
@@ -26,7 +26,7 @@ static const u32 __cacheline_aligned ck[32] = {
 	0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
 };
 
-static const u8 __cacheline_aligned sbox[256] = {
+static const u8 ____cacheline_aligned sbox[256] = {
 	0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7,
 	0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
 	0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3,

base-commit: abfc7fad63940b8dfdfd25da6f0fa813d9561645
-- 
2.33.0


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

* Re: [PATCH] crypto: sm4 - Do not change section of ck and sbox
  2021-08-25 20:38 [PATCH] crypto: sm4 - Do not change section of ck and sbox Nathan Chancellor
@ 2021-08-26  6:25 ` Tianjia Zhang
  2021-09-17  3:18 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Tianjia Zhang @ 2021-08-26  6:25 UTC (permalink / raw)
  To: Nathan Chancellor, Herbert Xu
  Cc: David S. Miller, Nick Desaulniers, linux-crypto, linux-kernel,
	clang-built-linux, llvm

Hi Nathan,

Thanks for pointing it out.

On 8/26/21 4:38 AM, Nathan Chancellor wrote:
> When building with clang and GNU as, there is a warning about ignored
> changed section attributes:
> 
> /tmp/sm4-c916c8.s: Assembler messages:
> /tmp/sm4-c916c8.s:677: Warning: ignoring changed section attributes for
> .data..cacheline_aligned
> 
> "static const" places the data in .rodata but __cacheline_aligned has
> the section attribute to place it in .data..cacheline_aligned, in
> addition to the aligned attribute.
> 
> To keep the alignment but avoid attempting to change sections, use the
> ____cacheline_aligned attribute, which is just the aligned attribute.
> 
> Fixes: 2b31277af577 ("crypto: sm4 - create SM4 library based on sm4 generic code")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1441
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>


Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

Best regards,
Tianjia

> ---
>   lib/crypto/sm4.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/crypto/sm4.c b/lib/crypto/sm4.c
> index 633b59fed9db..284e62576d0c 100644
> --- a/lib/crypto/sm4.c
> +++ b/lib/crypto/sm4.c
> @@ -15,7 +15,7 @@ static const u32 fk[4] = {
>   	0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc
>   };
>   
> -static const u32 __cacheline_aligned ck[32] = {
> +static const u32 ____cacheline_aligned ck[32] = {
>   	0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
>   	0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
>   	0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
> @@ -26,7 +26,7 @@ static const u32 __cacheline_aligned ck[32] = {
>   	0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
>   };
>   
> -static const u8 __cacheline_aligned sbox[256] = {
> +static const u8 ____cacheline_aligned sbox[256] = {
>   	0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7,
>   	0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
>   	0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3,
> 
> base-commit: abfc7fad63940b8dfdfd25da6f0fa813d9561645
> 

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

* Re: [PATCH] crypto: sm4 - Do not change section of ck and sbox
  2021-08-25 20:38 [PATCH] crypto: sm4 - Do not change section of ck and sbox Nathan Chancellor
  2021-08-26  6:25 ` Tianjia Zhang
@ 2021-09-17  3:18 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-09-17  3:18 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: David S. Miller, Tianjia Zhang, Nick Desaulniers, linux-crypto,
	linux-kernel, clang-built-linux, llvm

On Wed, Aug 25, 2021 at 01:38:59PM -0700, Nathan Chancellor wrote:
> When building with clang and GNU as, there is a warning about ignored
> changed section attributes:
> 
> /tmp/sm4-c916c8.s: Assembler messages:
> /tmp/sm4-c916c8.s:677: Warning: ignoring changed section attributes for
> .data..cacheline_aligned
> 
> "static const" places the data in .rodata but __cacheline_aligned has
> the section attribute to place it in .data..cacheline_aligned, in
> addition to the aligned attribute.
> 
> To keep the alignment but avoid attempting to change sections, use the
> ____cacheline_aligned attribute, which is just the aligned attribute.
> 
> Fixes: 2b31277af577 ("crypto: sm4 - create SM4 library based on sm4 generic code")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1441
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  lib/crypto/sm4.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 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] 3+ messages in thread

end of thread, other threads:[~2021-09-17  3:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 20:38 [PATCH] crypto: sm4 - Do not change section of ck and sbox Nathan Chancellor
2021-08-26  6:25 ` Tianjia Zhang
2021-09-17  3:18 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).