2022-07-02 22:56:07

by kernel test robot

[permalink] [raw]
Subject: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 69cb6c6556ad89620547318439d6be8bb1629a5a
commit: 349d03ffd5f62c298fd667ffa397c3fdc5c6194b crypto: s390 - add crypto library interface for ChaCha20
date: 7 weeks ago
config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
compiler: s390-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=349d03ffd5f62c298fd667ffa397c3fdc5c6194b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 349d03ffd5f62c298fd667ffa397c3fdc5c6194b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
>> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
>> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_init':
>> include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
>> s390-linux-ld: include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `hchacha_block':
>> include/crypto/chacha.h:45: undefined reference to `hchacha_block_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_init':
>> include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
>> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
>> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_init':
>> include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
>> s390-linux-ld: include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
>> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
>> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
>> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
s390-linux-ld: lib/crypto/chacha20poly1305-selftest.o: in function `chacha_init':
>> include/crypto/chacha.h:86: undefined reference to `chacha_init_arch'
s390-linux-ld: lib/crypto/chacha20poly1305-selftest.o: in function `chacha_crypt':
>> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
>> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO
Selected by
- WIREGUARD && NETDEVICES && NET_CORE && NET && INET && (IPV6 || !IPV6


vim +100 include/crypto/chacha.h

5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 41
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 42 static inline void hchacha_block(const u32 *state, u32 *out, int nrounds)
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 43 {
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 44 if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA))
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 @45 hchacha_block_arch(state, out, nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 46 else
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 47 hchacha_block_generic(state, out, nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 48 }
1ca1b917940c24 Eric Biggers 2018-11-16 49
96562f286884e2 Dominik Brodowski 2021-12-31 50 enum chacha_constants { /* expand 32-byte k */
96562f286884e2 Dominik Brodowski 2021-12-31 51 CHACHA_CONSTANT_EXPA = 0x61707865U,
96562f286884e2 Dominik Brodowski 2021-12-31 52 CHACHA_CONSTANT_ND_3 = 0x3320646eU,
96562f286884e2 Dominik Brodowski 2021-12-31 53 CHACHA_CONSTANT_2_BY = 0x79622d32U,
96562f286884e2 Dominik Brodowski 2021-12-31 54 CHACHA_CONSTANT_TE_K = 0x6b206574U
96562f286884e2 Dominik Brodowski 2021-12-31 55 };
96562f286884e2 Dominik Brodowski 2021-12-31 56
a181e0fdb21642 Eric Biggers 2021-03-21 57 static inline void chacha_init_consts(u32 *state)
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 58 {
96562f286884e2 Dominik Brodowski 2021-12-31 59 state[0] = CHACHA_CONSTANT_EXPA;
96562f286884e2 Dominik Brodowski 2021-12-31 60 state[1] = CHACHA_CONSTANT_ND_3;
96562f286884e2 Dominik Brodowski 2021-12-31 61 state[2] = CHACHA_CONSTANT_2_BY;
96562f286884e2 Dominik Brodowski 2021-12-31 62 state[3] = CHACHA_CONSTANT_TE_K;
a181e0fdb21642 Eric Biggers 2021-03-21 63 }
a181e0fdb21642 Eric Biggers 2021-03-21 64
a181e0fdb21642 Eric Biggers 2021-03-21 65 void chacha_init_arch(u32 *state, const u32 *key, const u8 *iv);
a181e0fdb21642 Eric Biggers 2021-03-21 66 static inline void chacha_init_generic(u32 *state, const u32 *key, const u8 *iv)
a181e0fdb21642 Eric Biggers 2021-03-21 67 {
a181e0fdb21642 Eric Biggers 2021-03-21 68 chacha_init_consts(state);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 69 state[4] = key[0];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 70 state[5] = key[1];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 71 state[6] = key[2];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 72 state[7] = key[3];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 73 state[8] = key[4];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 74 state[9] = key[5];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 75 state[10] = key[6];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 76 state[11] = key[7];
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 77 state[12] = get_unaligned_le32(iv + 0);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 78 state[13] = get_unaligned_le32(iv + 4);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 79 state[14] = get_unaligned_le32(iv + 8);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 80 state[15] = get_unaligned_le32(iv + 12);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 81 }
1ca1b917940c24 Eric Biggers 2018-11-16 82
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 83 static inline void chacha_init(u32 *state, const u32 *key, const u8 *iv)
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 84 {
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 85 if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA))
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 @86 chacha_init_arch(state, key, iv);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 87 else
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 88 chacha_init_generic(state, key, iv);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 89 }
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 90
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 91 void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src,
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 92 unsigned int bytes, int nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 93 void chacha_crypt_generic(u32 *state, u8 *dst, const u8 *src,
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 94 unsigned int bytes, int nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 95
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 96 static inline void chacha_crypt(u32 *state, u8 *dst, const u8 *src,
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 97 unsigned int bytes, int nrounds)
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 98 {
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 99 if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA))
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 @100 chacha_crypt_arch(state, dst, src, bytes, nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 101 else
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 102 chacha_crypt_generic(state, dst, src, bytes, nrounds);
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 103 }
5fb8ef25803ef3 Ard Biesheuvel 2019-11-08 104

:::::: The code at line 100 was first introduced by commit
:::::: 5fb8ef25803ef33e2eb60b626435828b937bed75 crypto: chacha - move existing library code into lib/crypto

:::::: TO: Ard Biesheuvel <[email protected]>
:::::: CC: Herbert Xu <[email protected]>

--
0-DAY CI Kernel Test Service
https://01.org/lkp


2022-07-04 14:47:36

by Vladis Dronov

[permalink] [raw]
Subject: Re: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Hi,

On Sun, Jul 3, 2022 at 12:51 AM kernel test robot <[email protected]> wrote:
> ...
> config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
> ...
> s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
> >> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> >> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> ...
> Kconfig warnings: (for reference only)
> WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
> Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO

Ok, this is either weird or I do not understand how the Kconfig system works.

What I look at is CRYPTO_LIB_CHACHA20POLY1305 definition:

[ lib/crypto/Kconfig ]
config CRYPTO_LIB_CHACHA20POLY1305
tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)"
depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA
depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305
depends on CRYPTO

and this test's random config (s390-buildonly-randconfig-r005-20220703):

$ grep -e CRYPTO_LIB_CHACHA20POLY1305 -e CRYPTO_ARCH_HAVE_LIB_CHACHA
-e CRYPTO_ARCH_HAVE_LIB_POLY1305 -e CRYPTO= config
CONFIG_CRYPTO=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
// missing CRYPTO_ARCH_HAVE_LIB_POLY1305 implies =n (I guess?)

I'm following the canonical "Kconfig Language" doc (
https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html )
which states:

> - dependencies: “depends on” <expr>
> This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with ‘&&’.

and

> '!' <expr> (6)
> <expr> '&&' <expr> (7)
> <expr> '||' <expr> (8)
>
> 6. Returns the result of (2-/expr/).
> 7. Returns the result of min(/expr/, /expr/).
> 8. Returns the result of max(/expr/, /expr/).
> An expression can have a value of ‘n’, ‘m’ or ‘y’ (or 0, 1, 2 respectively for calculations).

So calculating:

(CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA) &&
(CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305) &&
CRYPTO

I find it equal to:

(m || !m) && (n || !n) && y => m && y && y => m

So CRYPTO_LIB_CHACHA20POLY1305 should be no higher than M, but it is
=Y in a config file => weird :\ (or me wrong somewhere).

WDYT?

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

2022-07-04 15:23:39

by Vladis Dronov

[permalink] [raw]
Subject: Re: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Hi,

On Mon, Jul 4, 2022 at 4:35 PM Vlad Dronov <[email protected]> wrote:
>
> Hi,
>
> On Sun, Jul 3, 2022 at 12:51 AM kernel test robot <[email protected]> wrote:
> > ...
> > config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
> > ...
> > s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
> > >> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > >> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > ...
> > Kconfig warnings: (for reference only)
> > WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
> > Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO
>
> Ok, this is either weird or I do not understand how the Kconfig system works.
>
> What I look at is CRYPTO_LIB_CHACHA20POLY1305 definition:
>
> [ lib/crypto/Kconfig ]
> config CRYPTO_LIB_CHACHA20POLY1305
> tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)"
> depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA
> depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305
> depends on CRYPTO
>
> and this test's random config (s390-buildonly-randconfig-r005-20220703):
>
> $ grep -e CRYPTO_LIB_CHACHA20POLY1305 -e CRYPTO_ARCH_HAVE_LIB_CHACHA
> -e CRYPTO_ARCH_HAVE_LIB_POLY1305 -e CRYPTO= config
> CONFIG_CRYPTO=y
> CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
> // missing CRYPTO_ARCH_HAVE_LIB_POLY1305 implies =n (I guess?)
>
> I'm following the canonical "Kconfig Language" doc (
> https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html )
> which states:
>
> > - dependencies: “depends on” <expr>
> > This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with ‘&&’.
>
> and
>
> > '!' <expr> (6)
> > <expr> '&&' <expr> (7)
> > <expr> '||' <expr> (8)
> >
> > 6. Returns the result of (2-/expr/).
> > 7. Returns the result of min(/expr/, /expr/).
> > 8. Returns the result of max(/expr/, /expr/).
> > An expression can have a value of ‘n’, ‘m’ or ‘y’ (or 0, 1, 2 respectively for calculations).
>
> So calculating:
>
> (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA) &&
> (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305) &&
> CRYPTO
>
> I find it equal to:
>
> (m || !m) && (n || !n) && y => m && y && y => m
>
> So CRYPTO_LIB_CHACHA20POLY1305 should be no higher than M, but it is
> =Y in a config file => weird :\ (or me wrong somewhere).
>
> WDYT?

Ok, I should have tested this beforehand. With the configs set as above:

CONFIG_CRYPTO=y
CONFIG_CRYPTO_CHACHA20_X86_64=m // implies the next line =m
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305 is not set // =n

"make menuconfig" allows only =n and =m for CRYPTO_LIB_CHACHA20POLY1305 indeed.
So the test robot has fed an invalid config to a build process. Let me
forward this thread to
[email protected] to report this issue.

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

2022-07-04 15:26:23

by Vladis Dronov

[permalink] [raw]
Subject: Re: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Hi,

On Mon, Jul 4, 2022 at 4:58 PM Vlad Dronov <[email protected]> wrote:
>
> Hi,
>
> On Mon, Jul 4, 2022 at 4:35 PM Vlad Dronov <[email protected]> wrote:
> >
> > Hi,
> >
> > On Sun, Jul 3, 2022 at 12:51 AM kernel test robot <[email protected]> wrote:
> > > ...
> > > config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
> > > ...
> > > s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
> > > >> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > >> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > ...
> > > Kconfig warnings: (for reference only)
> > > WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
> > > Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO
> >
> > Ok, this is either weird or I do not understand how the Kconfig system works.
> >
> > What I look at is CRYPTO_LIB_CHACHA20POLY1305 definition:
> >
> > [ lib/crypto/Kconfig ]
> > config CRYPTO_LIB_CHACHA20POLY1305
> > tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)"
> > depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA
> > depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305
> > depends on CRYPTO
> >
> > and this test's random config (s390-buildonly-randconfig-r005-20220703):
> >
> > $ grep -e CRYPTO_LIB_CHACHA20POLY1305 -e CRYPTO_ARCH_HAVE_LIB_CHACHA
> > -e CRYPTO_ARCH_HAVE_LIB_POLY1305 -e CRYPTO= config
> > CONFIG_CRYPTO=y
> > CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> > CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
> > // missing CRYPTO_ARCH_HAVE_LIB_POLY1305 implies =n (I guess?)
> >
> > I'm following the canonical "Kconfig Language" doc (
> > https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html )
> > which states:
> >
> > > - dependencies: “depends on” <expr>
> > > This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with ‘&&’.
> >
> > and
> >
> > > '!' <expr> (6)
> > > <expr> '&&' <expr> (7)
> > > <expr> '||' <expr> (8)
> > >
> > > 6. Returns the result of (2-/expr/).
> > > 7. Returns the result of min(/expr/, /expr/).
> > > 8. Returns the result of max(/expr/, /expr/).
> > > An expression can have a value of ‘n’, ‘m’ or ‘y’ (or 0, 1, 2 respectively for calculations).
> >
> > So calculating:
> >
> > (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA) &&
> > (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305) &&
> > CRYPTO
> >
> > I find it equal to:
> >
> > (m || !m) && (n || !n) && y => m && y && y => m
> >
> > So CRYPTO_LIB_CHACHA20POLY1305 should be no higher than M, but it is
> > =Y in a config file => weird :\ (or me wrong somewhere).
> >
> > WDYT?
>
> Ok, I should have tested this beforehand. With the configs set as above:
>
> CONFIG_CRYPTO=y
> CONFIG_CRYPTO_CHACHA20_X86_64=m // implies the next line =m
> CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305 is not set // =n
>
> "make menuconfig" allows only =n and =m for CRYPTO_LIB_CHACHA20POLY1305 indeed.
> So the test robot has fed an invalid config to a build process. Let me
> forward this thread to [email protected] to report this issue.

Hi,

False alarm, I apologize.

CRYPTO_LIB_CHACHA20POLY1305=y was selected by CONFIG_WIREGUARD=y:

config WIREGUARD
tristate "WireGuard secure network tunnel"
depends on NET && INET
depends on IPV6 || !IPV6
select CRYPTO_LIB_CHACHA20POLY1305

$ grep -e CONFIG_WIREGUARD= -e CONFIG_NETDEVICES= -e CONFIG_NET_CORE=
-e CONFIG_NET= -e CONFIG_INET= -e CONFIG_IPV6= config
CONFIG_NET=y
CONFIG_INET=y
CONFIG_IPV6=y
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
CONFIG_WIREGUARD=y

This breaks the "In general use select only for non-visible symbols
(no prompts anywhere)
and for symbols with no dependencies" rules from the "Kconfig
Language" doc, but I'm not
sure how to proceed from here.

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

2022-07-04 16:00:25

by Vladis Dronov

[permalink] [raw]
Subject: Re: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Hi,

On Mon, Jul 4, 2022 at 5:24 PM Vlad Dronov <[email protected]> wrote:
>
> Hi,
>
> On Mon, Jul 4, 2022 at 4:58 PM Vlad Dronov <[email protected]> wrote:
> >
> > Hi,
> >
> > On Mon, Jul 4, 2022 at 4:35 PM Vlad Dronov <[email protected]> wrote:
> > >
> > > Hi,
> > >
> > > On Sun, Jul 3, 2022 at 12:51 AM kernel test robot <[email protected]> wrote:
> > > > ...
> > > > config: s390-buildonly-randconfig-r005-20220703 (https://download.01.org/0day-ci/archive/20220703/[email protected]/config)
> > > > ...
> > > > s390-linux-ld: lib/crypto/chacha20poly1305.o: in function `chacha_crypt':
> > > > >> include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > > >> s390-linux-ld: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'
> > > > ...
> > > > Kconfig warnings: (for reference only)
> > > > WARNING: unmet direct dependencies detected for CRYPTO_LIB_CHACHA20POLY1305
> > > > Depends on (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA && (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305 && CRYPTO
> > >
> > > Ok, this is either weird or I do not understand how the Kconfig system works.
> > >
> > > What I look at is CRYPTO_LIB_CHACHA20POLY1305 definition:
> > >
> > > [ lib/crypto/Kconfig ]
> > > config CRYPTO_LIB_CHACHA20POLY1305
> > > tristate "ChaCha20-Poly1305 AEAD support (8-byte nonce library version)"
> > > depends on CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA
> > > depends on CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305
> > > depends on CRYPTO
> > >
> > > and this test's random config (s390-buildonly-randconfig-r005-20220703):
> > >
> > > $ grep -e CRYPTO_LIB_CHACHA20POLY1305 -e CRYPTO_ARCH_HAVE_LIB_CHACHA
> > > -e CRYPTO_ARCH_HAVE_LIB_POLY1305 -e CRYPTO= config
> > > CONFIG_CRYPTO=y
> > > CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> > > CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
> > > // missing CRYPTO_ARCH_HAVE_LIB_POLY1305 implies =n (I guess?)
> > >
> > > I'm following the canonical "Kconfig Language" doc (
> > > https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html )
> > > which states:
> > >
> > > > - dependencies: “depends on” <expr>
> > > > This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with ‘&&’.
> > >
> > > and
> > >
> > > > '!' <expr> (6)
> > > > <expr> '&&' <expr> (7)
> > > > <expr> '||' <expr> (8)
> > > >
> > > > 6. Returns the result of (2-/expr/).
> > > > 7. Returns the result of min(/expr/, /expr/).
> > > > 8. Returns the result of max(/expr/, /expr/).
> > > > An expression can have a value of ‘n’, ‘m’ or ‘y’ (or 0, 1, 2 respectively for calculations).
> > >
> > > So calculating:
> > >
> > > (CRYPTO_ARCH_HAVE_LIB_CHACHA || !CRYPTO_ARCH_HAVE_LIB_CHACHA) &&
> > > (CRYPTO_ARCH_HAVE_LIB_POLY1305 || !CRYPTO_ARCH_HAVE_LIB_POLY1305) &&
> > > CRYPTO
> > >
> > > I find it equal to:
> > >
> > > (m || !m) && (n || !n) && y => m && y && y => m
> > >
> > > So CRYPTO_LIB_CHACHA20POLY1305 should be no higher than M, but it is
> > > =Y in a config file => weird :\ (or me wrong somewhere).
> > >
> > > WDYT?
> >
> > Ok, I should have tested this beforehand. With the configs set as above:
> >
> > CONFIG_CRYPTO=y
> > CONFIG_CRYPTO_CHACHA20_X86_64=m // implies the next line =m
> > CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
> > CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305 is not set // =n
> >
> > "make menuconfig" allows only =n and =m for CRYPTO_LIB_CHACHA20POLY1305 indeed.
> > So the test robot has fed an invalid config to a build process. Let me
> > forward this thread to [email protected] to report this issue.
>
> Hi,
>
> False alarm, I apologize.
>
> CRYPTO_LIB_CHACHA20POLY1305=y was selected by CONFIG_WIREGUARD=y:
>
> config WIREGUARD
> tristate "WireGuard secure network tunnel"
> depends on NET && INET
> depends on IPV6 || !IPV6
> select CRYPTO_LIB_CHACHA20POLY1305
>
> $ grep -e CONFIG_WIREGUARD= -e CONFIG_NETDEVICES= -e CONFIG_NET_CORE=
> -e CONFIG_NET= -e CONFIG_INET= -e CONFIG_IPV6= config
> CONFIG_NET=y
> CONFIG_INET=y
> CONFIG_IPV6=y
> CONFIG_NETDEVICES=y
> CONFIG_NET_CORE=y
> CONFIG_WIREGUARD=y
>
> This breaks the "In general use select only for non-visible symbols
> (no prompts anywhere)
> and for symbols with no dependencies" rules from the "Kconfig
> Language" doc, but I'm not
> sure how to proceed from here.

JFYI: fed with a config in question, "make menuconfig" just silently changes
CONFIG_CRYPTO_CHACHA_S390=m to =y
and, accordingly,
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m to =y
thus allowing a correct build.

Still not sure how to proceed from here with this clarification above.

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer

2022-07-04 20:14:50

by Vladis Dronov

[permalink] [raw]
Subject: Re: include/crypto/chacha.h:100: undefined reference to `chacha_crypt_arch'

Hi,

On Mon, Jul 4, 2022 at 5:42 PM Vlad Dronov <[email protected]> wrote:
> ...skip...
>
> JFYI: fed with a config in question, "make menuconfig" just silently changes
> CONFIG_CRYPTO_CHACHA_S390=m to =y
> and, accordingly,
> CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m to =y
> thus allowing a correct build.
>
> Still not sure how to proceed from here with this clarification above.

Ok, I'm sorry for the traffic. The fix was posted:

https://lore.kernel.org/netdev/[email protected]/T/#u

Best regards,
Vladis Dronov | Red Hat, Inc. | The Core Kernel | Senior Software Engineer