* [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
@ 2022-01-11 6:26 Herbert Xu
2022-01-11 21:43 ` Eric Biggers
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Herbert Xu @ 2022-01-11 6:26 UTC (permalink / raw)
To: Eric Biggers, Linux Crypto Mailing List
As testmgr is part of cryptomgr which was designed to be unloadable
as a module, it shouldn't export any symbols for other crypto
modules to use as that would prevent it from being unloaded. All
its functionality is meant to be accessed through notifiers.
The symbol crypto_simd_disabled_for_test was added to testmgr
which caused it to be pinned as a module if its users were also
loaded. This patch moves it out of testmgr and into crypto/simd.c
so cryptomgr can again be unloaded and replaced on demand.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/crypto/simd.c b/crypto/simd.c
index edaa479a1ec5..2027d747b746 100644
--- a/crypto/simd.c
+++ b/crypto/simd.c
@@ -47,6 +47,11 @@ struct simd_skcipher_ctx {
struct cryptd_skcipher *cryptd_tfm;
};
+#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
+DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
+EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
+#endif
+
static int simd_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
unsigned int key_len)
{
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 5831d4bbc64f..3a5a3e5cb77b 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -55,9 +55,6 @@ MODULE_PARM_DESC(noextratests, "disable expensive crypto self-tests");
static unsigned int fuzz_iterations = 100;
module_param(fuzz_iterations, uint, 0644);
MODULE_PARM_DESC(fuzz_iterations, "number of fuzz test iterations");
-
-DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
-EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
#endif
#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
--
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 related [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-11 6:26 [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out Herbert Xu
@ 2022-01-11 21:43 ` Eric Biggers
2022-01-12 0:58 ` Herbert Xu
2022-01-12 13:35 ` [PATCH] " kernel test robot
2022-01-12 13:36 ` kernel test robot
2 siblings, 1 reply; 7+ messages in thread
From: Eric Biggers @ 2022-01-11 21:43 UTC (permalink / raw)
To: Herbert Xu; +Cc: Linux Crypto Mailing List
On Tue, Jan 11, 2022 at 05:26:11PM +1100, Herbert Xu wrote:
> As testmgr is part of cryptomgr which was designed to be unloadable
> as a module, it shouldn't export any symbols for other crypto
> modules to use as that would prevent it from being unloaded. All
> its functionality is meant to be accessed through notifiers.
>
> The symbol crypto_simd_disabled_for_test was added to testmgr
> which caused it to be pinned as a module if its users were also
> loaded. This patch moves it out of testmgr and into crypto/simd.c
> so cryptomgr can again be unloaded and replaced on demand.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/crypto/simd.c b/crypto/simd.c
> index edaa479a1ec5..2027d747b746 100644
> --- a/crypto/simd.c
> +++ b/crypto/simd.c
> @@ -47,6 +47,11 @@ struct simd_skcipher_ctx {
> struct cryptd_skcipher *cryptd_tfm;
> };
>
> +#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
> +DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
> +EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
> +#endif
> +
> static int simd_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
> unsigned int key_len)
> {
It doesn't look like all the users of crypto_simd_usable() select CRYPTO_SIMD.
So this will cause a build break in some configurations.
Maybe CRYPTO_MANAGER_EXTRA_TESTS should select CRYPTO_SIMD?
- Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-11 21:43 ` Eric Biggers
@ 2022-01-12 0:58 ` Herbert Xu
2022-01-14 6:40 ` [v2 PATCH] " Herbert Xu
0 siblings, 1 reply; 7+ messages in thread
From: Herbert Xu @ 2022-01-12 0:58 UTC (permalink / raw)
To: Eric Biggers; +Cc: Linux Crypto Mailing List
On Tue, Jan 11, 2022 at 01:43:58PM -0800, Eric Biggers wrote:
>
> Maybe CRYPTO_MANAGER_EXTRA_TESTS should select CRYPTO_SIMD?
You're right. I was focusing only on the module dependencies
but neglected to change the Kconfig dependencies.
I'll fix this in the next version.
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] 7+ messages in thread
* Re: [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-11 6:26 [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out Herbert Xu
2022-01-11 21:43 ` Eric Biggers
@ 2022-01-12 13:35 ` kernel test robot
2022-01-12 13:36 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-01-12 13:35 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2446 bytes --]
Hi Herbert,
I love your patch! Yet something to improve:
[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master v5.16 next-20220112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/crypto-testmgr-Move-crypto_simd_disabled_for_test-out/20220111-142629
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: microblaze-randconfig-m031-20220112 (https://download.01.org/0day-ci/archive/20220112/202201122102.IDRhe0CL-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/0f7cdd91b1d219ea69c7a4db6f248cd66571444c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Herbert-Xu/crypto-testmgr-Move-crypto_simd_disabled_for_test-out/20220111-142629
git checkout 0f7cdd91b1d219ea69c7a4db6f248cd66571444c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
microblaze-linux-ld: crypto/testmgr.o: in function `test_shash_vec_cfg':
>> (.text+0x4094): undefined reference to `crypto_simd_disabled_for_test'
>> microblaze-linux-ld: (.text+0x4168): undefined reference to `crypto_simd_disabled_for_test'
microblaze-linux-ld: (.text+0x41e8): undefined reference to `crypto_simd_disabled_for_test'
microblaze-linux-ld: (.text+0x421c): undefined reference to `crypto_simd_disabled_for_test'
microblaze-linux-ld: (.text+0x42c4): undefined reference to `crypto_simd_disabled_for_test'
microblaze-linux-ld: crypto/testmgr.o:(.text+0x43c8): more undefined references to `crypto_simd_disabled_for_test' follow
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-11 6:26 [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out Herbert Xu
2022-01-11 21:43 ` Eric Biggers
2022-01-12 13:35 ` [PATCH] " kernel test robot
@ 2022-01-12 13:36 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-01-12 13:36 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]
Hi Herbert,
I love your patch! Yet something to improve:
[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master v5.16 next-20220112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/crypto-testmgr-Move-crypto_simd_disabled_for_test-out/20220111-142629
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arc-buildonly-randconfig-r002-20220112 (https://download.01.org/0day-ci/archive/20220112/202201122118.9upgX2kg-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.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://github.com/0day-ci/linux/commit/0f7cdd91b1d219ea69c7a4db6f248cd66571444c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Herbert-Xu/crypto-testmgr-Move-crypto_simd_disabled_for_test-out/20220111-142629
git checkout 0f7cdd91b1d219ea69c7a4db6f248cd66571444c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arceb-elf-ld: crypto/testmgr.o: in function `do_ahash_op':
testmgr.c:(.text+0x1286): undefined reference to `crypto_simd_disabled_for_test'
>> arceb-elf-ld: testmgr.c:(.text+0x1286): undefined reference to `crypto_simd_disabled_for_test'
arceb-elf-ld: testmgr.c:(.text+0x129e): undefined reference to `crypto_simd_disabled_for_test'
arceb-elf-ld: testmgr.c:(.text+0x129e): undefined reference to `crypto_simd_disabled_for_test'
arceb-elf-ld: crypto/testmgr.o: in function `test_shash_vec_cfg.isra.0':
testmgr.c:(.text+0x20da): undefined reference to `crypto_simd_disabled_for_test'
arceb-elf-ld: crypto/testmgr.o:testmgr.c:(.text+0x20da): more undefined references to `crypto_simd_disabled_for_test' follow
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [v2 PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-12 0:58 ` Herbert Xu
@ 2022-01-14 6:40 ` Herbert Xu
2022-01-14 21:57 ` Eric Biggers
0 siblings, 1 reply; 7+ messages in thread
From: Herbert Xu @ 2022-01-14 6:40 UTC (permalink / raw)
To: Eric Biggers; +Cc: Linux Crypto Mailing List
On Wed, Jan 12, 2022 at 11:58:00AM +1100, Herbert Xu wrote:
> On Tue, Jan 11, 2022 at 01:43:58PM -0800, Eric Biggers wrote:
> >
> > Maybe CRYPTO_MANAGER_EXTRA_TESTS should select CRYPTO_SIMD?
>
> You're right. I was focusing only on the module dependencies
> but neglected to change the Kconfig dependencies.
>
> I'll fix this in the next version.
---8<---
As testmgr is part of cryptomgr which was designed to be unloadable
as a module, it shouldn't export any symbols for other crypto
modules to use as that would prevent it from being unloaded. All
its functionality is meant to be accessed through notifiers.
The symbol crypto_simd_disabled_for_test was added to testmgr
which caused it to be pinned as a module if its users were also
loaded. This patch moves it out of testmgr and into crypto/algapi.c
so cryptomgr can again be unloaded and replaced on demand.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/crypto/algapi.c b/crypto/algapi.c
index a366cb3e8aa1..9f15e11f5d73 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -6,6 +6,7 @@
*/
#include <crypto/algapi.h>
+#include <crypto/internal/simd.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/fips.h>
@@ -21,6 +22,11 @@
static LIST_HEAD(crypto_template_list);
+#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
+DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
+EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
+#endif
+
static inline void crypto_check_module_sig(struct module *mod)
{
if (fips_enabled && mod && !module_sig_ok(mod))
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 5831d4bbc64f..3a5a3e5cb77b 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -55,9 +55,6 @@ MODULE_PARM_DESC(noextratests, "disable expensive crypto self-tests");
static unsigned int fuzz_iterations = 100;
module_param(fuzz_iterations, uint, 0644);
MODULE_PARM_DESC(fuzz_iterations, "number of fuzz test iterations");
-
-DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
-EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
#endif
#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
--
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 related [flat|nested] 7+ messages in thread
* Re: [v2 PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out
2022-01-14 6:40 ` [v2 PATCH] " Herbert Xu
@ 2022-01-14 21:57 ` Eric Biggers
0 siblings, 0 replies; 7+ messages in thread
From: Eric Biggers @ 2022-01-14 21:57 UTC (permalink / raw)
To: Herbert Xu; +Cc: Linux Crypto Mailing List
On Fri, Jan 14, 2022 at 05:40:30PM +1100, Herbert Xu wrote:
> On Wed, Jan 12, 2022 at 11:58:00AM +1100, Herbert Xu wrote:
> > On Tue, Jan 11, 2022 at 01:43:58PM -0800, Eric Biggers wrote:
> > >
> > > Maybe CRYPTO_MANAGER_EXTRA_TESTS should select CRYPTO_SIMD?
> >
> > You're right. I was focusing only on the module dependencies
> > but neglected to change the Kconfig dependencies.
> >
> > I'll fix this in the next version.
>
> ---8<---
> As testmgr is part of cryptomgr which was designed to be unloadable
> as a module, it shouldn't export any symbols for other crypto
> modules to use as that would prevent it from being unloaded. All
> its functionality is meant to be accessed through notifiers.
>
> The symbol crypto_simd_disabled_for_test was added to testmgr
> which caused it to be pinned as a module if its users were also
> loaded. This patch moves it out of testmgr and into crypto/algapi.c
> so cryptomgr can again be unloaded and replaced on demand.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
Reviewed-by: Eric Biggers <ebiggers@google.com>
- Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-14 21:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 6:26 [PATCH] crypto: testmgr - Move crypto_simd_disabled_for_test out Herbert Xu
2022-01-11 21:43 ` Eric Biggers
2022-01-12 0:58 ` Herbert Xu
2022-01-14 6:40 ` [v2 PATCH] " Herbert Xu
2022-01-14 21:57 ` Eric Biggers
2022-01-12 13:35 ` [PATCH] " kernel test robot
2022-01-12 13:36 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.