linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/crypto: arm/poly1305: fix poly1305_blocks_neon link failure
@ 2025-07-11  7:23 Arnd Bergmann
  2025-07-11 21:34 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-07-11  7:23 UTC (permalink / raw)
  To: Eric Biggers, Jason A. Donenfeld, Ard Biesheuvel
  Cc: Arnd Bergmann, Herbert Xu, Sohil Mehta, Martin K. Petersen,
	linux-crypto, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The reference to poly1305_blocks_neon from generated assembler code is
apparently the reason we had the silly __weak function in the wrapper.
Removing it introduced a link failure:

ERROR: modpost: "poly1305_blocks_neon" [lib/crypto/arm/poly1305-arm.ko] undefined!

Moving the reference inside of the #if ARMv7 block avoids this problem.

Fixes: 16f9e0cc99ec ("lib/crypto: arm/poly1305: Remove unneeded empty weak function")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I see that the neon code is always built when targetting ARMv7, even in
configurations without CONFIG_KERNEL_MODE_NEON where it is never called.
I tried cleaning that up as well but couldn't figure it out.
---
 lib/crypto/arm/poly1305-armv4.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crypto/arm/poly1305-armv4.pl b/lib/crypto/arm/poly1305-armv4.pl
index d57c6e2fc84a..dd7a996361a7 100644
--- a/lib/crypto/arm/poly1305-armv4.pl
+++ b/lib/crypto/arm/poly1305-armv4.pl
@@ -46,7 +46,6 @@ $code.=<<___;
 # define poly1305_init   poly1305_block_init_arch
 # define poly1305_blocks poly1305_blocks_arm
 # define poly1305_emit   poly1305_emit_arch
-.globl	poly1305_blocks_neon
 #endif
 
 #if defined(__thumb2__)
@@ -722,6 +721,7 @@ poly1305_init_neon:
 	ret				@ bx	lr
 .size	poly1305_init_neon,.-poly1305_init_neon
 
+.globl	poly1305_blocks_neon
 .type	poly1305_blocks_neon,%function
 .align	5
 poly1305_blocks_neon:
-- 
2.39.5


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

* Re: [PATCH] lib/crypto: arm/poly1305: fix poly1305_blocks_neon link failure
  2025-07-11  7:23 [PATCH] lib/crypto: arm/poly1305: fix poly1305_blocks_neon link failure Arnd Bergmann
@ 2025-07-11 21:34 ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2025-07-11 21:34 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jason A. Donenfeld, Ard Biesheuvel, Arnd Bergmann, Herbert Xu,
	Sohil Mehta, Martin K. Petersen, linux-crypto, linux-kernel

On Fri, Jul 11, 2025 at 09:23:59AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The reference to poly1305_blocks_neon from generated assembler code is
> apparently the reason we had the silly __weak function in the wrapper.
> Removing it introduced a link failure:
> 
> ERROR: modpost: "poly1305_blocks_neon" [lib/crypto/arm/poly1305-arm.ko] undefined!
> 
> Moving the reference inside of the #if ARMv7 block avoids this problem.
> 
> Fixes: 16f9e0cc99ec ("lib/crypto: arm/poly1305: Remove unneeded empty weak function")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I see that the neon code is always built when targetting ARMv7, even in
> configurations without CONFIG_KERNEL_MODE_NEON where it is never called.
> I tried cleaning that up as well but couldn't figure it out.
> ---
>  lib/crypto/arm/poly1305-armv4.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks!  That's an interesting one... unfortunately the "perlasm" files
are kind of a mess.

To avoid a bisection hazard, I'm replacing the original patch with an
updated version that includes your fix:
https://lore.kernel.org/r/20250711212822.6372-1-ebiggers@kernel.org

- Eric

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

end of thread, other threads:[~2025-07-11 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11  7:23 [PATCH] lib/crypto: arm/poly1305: fix poly1305_blocks_neon link failure Arnd Bergmann
2025-07-11 21:34 ` Eric Biggers

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).