Skip to contentSkip to conversation

REGRESSION: ChaCha fails to build in randconfig

DISCUSSION Russell King - ARM Linux admin 3 participants 3 messages Jan 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Ard,

Randconfig builds have found an issue with a commit in the last merge window:

chacha-glue.c:(.text+0xc0): undefined reference to `chacha_4block_xor_neon'

This seems to be a result of this commit:

commit b36d8c09e710c71f6a9690b6586fea2d1c9e1e27

Author: Ard Biesheuvel <[email protected]>
Date:   Fri Nov 8 13:22:14 2019 +0100

crypto: arm/chacha - remove dependency on generic ChaCha driver

CRYPTO_CHACHA20_NEON does not depend on KERNEL_MODE_NEON, yet the makefile has:

obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o chacha-neon-y := chacha-scalar-core.o chacha-glue.o chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o

chacha-glue.c refers to chacha_4block_xor_neon in chacha_doneon(), and I guess some compilers are not clever enough to eliminate that code with KERNEL_MODE_NEON is disabled.

Arnd has a patch that adds a dependency to stop this being a problem, but that is probably not what you want. Please fix.

Thanks.

Signature · 8 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 23 lines · Russell King - ARM Linux admin

Ard,

Randconfig builds have found an issue with a commit in the last merge window:

chacha-glue.c:(.text+0xc0): undefined reference to `chacha_4block_xor_neon'

This seems to be a result of this commit:

commit b36d8c09e710c71f6a9690b6586fea2d1c9e1e27

Author: Ard Biesheuvel <[email protected]>
Date:   Fri Nov 8 13:22:14 2019 +0100

crypto: arm/chacha - remove dependency on generic ChaCha driver

CRYPTO_CHACHA20_NEON does not depend on KERNEL_MODE_NEON, yet the makefile has:

obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o chacha-neon-y := chacha-scalar-core.o chacha-glue.o chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o

Quoted 7 lines

chacha-glue.c refers to chacha_4block_xor_neon in chacha_doneon(), and I guess some compilers are not clever enough to eliminate that code with KERNEL_MODE_NEON is disabled.

Arnd has a patch that adds a dependency to stop this being a problem, but that is probably not what you want. Please fix.

Thanks for the head's up

I'll post something along the lines of the below, that should convince the compiler that chacha_4block_xor_neon() is never called when CONFIG_KERNEL_MODE_NEON is not enabled.

arch/arm/crypto/chacha-glue.c +1 -1
@@ -115,7 +115,7 @@ static int chacha_stream_xor(struct skcipher_request *req,
                if (nbytes < walk.total)
                        nbytes = round_down(nbytes, walk.stride);
 
-               if (!neon) {
+               if (!IS_ENABLED(CONFIG_KERNEL_MODE_NEON) || !neon) {
                        chacha_doarm(walk.dst.virt.addr, walk.src.virt.addr,
                                     nbytes, state, ctx->nrounds);
                        state[12] += DIV_ROUND_UP(nbytes, CHACHA_BLOCK_SIZE);
@@ -159,7 +159,7 @@ static int do_xchacha(struct skcipher_request

*req, bool neon)

        chacha_init_generic(state, ctx->key, req->iv);

- if (!neon) {

+       if (!IS_ENABLED(CONFIG_KERNEL_MODE_NEON) || !neon) {
                hchacha_block_arm(state, subctx.key, ctx->nrounds);
        } else {
                kernel_neon_begin();

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
Quoted 34 lines · Ard Biesheuvel
Quoted 23 lines · Russell King - ARM Linux admin

Ard,

Randconfig builds have found an issue with a commit in the last merge window:

chacha-glue.c:(.text+0xc0): undefined reference to `chacha_4block_xor_neon'

This seems to be a result of this commit:

commit b36d8c09e710c71f6a9690b6586fea2d1c9e1e27

Author: Ard Biesheuvel <[email protected]>
Date:   Fri Nov 8 13:22:14 2019 +0100

crypto: arm/chacha - remove dependency on generic ChaCha driver

CRYPTO_CHACHA20_NEON does not depend on KERNEL_MODE_NEON, yet the makefile has:

obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o chacha-neon-y := chacha-scalar-core.o chacha-glue.o chacha-neon-$(CONFIG_KERNEL_MODE_NEON) += chacha-neon-core.o

Quoted 7 lines

chacha-glue.c refers to chacha_4block_xor_neon in chacha_doneon(), and I guess some compilers are not clever enough to eliminate that code with KERNEL_MODE_NEON is disabled.

Arnd has a patch that adds a dependency to stop this being a problem, but that is probably not what you want. Please fix.

Quoted 6 lines

Thanks for the head's up

I'll post something along the lines of the below, that should convince the compiler that chacha_4block_xor_neon() is never called when CONFIG_KERNEL_MODE_NEON is not enabled.

I also see this related warning on linux-next:

WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
Depends on [m]: CRYPTO [=y] && (CRYPTO_ARCH_HAVE_LIB_CHACHA [=m]

|| !CRYPTO_ARCH_HAVE_LIB_CHACHA [=m]) &&
(CRYPTO_ARCH_HAVE_LIB_POLY1305 [=y] || !CRYPTO_ARCH_HAVE_LIB_POLY1305

[=y])
Selected by [y]:
- WIREGUARD [=y] && NETDEVICES [=y] && NET_CORE [=y] && NET [=y]
&& INET [=y] && (IPV6 [=y] || !IPV6 [=y])

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel