REGRESSION: ChaCha fails to build in randconfig

Ard Biesheuvel ard.biesheuvel at linaro.org
Fri Jan 17 08:22:43 PST 2020


On Fri, 17 Jan 2020 at 17:02, Russell King - ARM Linux admin
<linux at armlinux.org.uk> wrote:
>
> 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 <ardb at kernel.org>
> 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 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.



--- a/arch/arm/crypto/chacha-glue.c
+++ b/arch/arm/crypto/chacha-glue.c
@@ -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();



More information about the linux-arm-kernel mailing list