diff mbox series

[RFC,v3,16/36] crypto: kmsan: disable accelerated configs under KMSAN

Message ID 20191122112621.204798-17-glider@google.com (mailing list archive)
State New, archived
Headers show
Series Add KernelMemorySanitizer infrastructure | expand

Commit Message

Alexander Potapenko Nov. 22, 2019, 11:26 a.m. UTC
KMSAN is unable to understand when initialized values come from assembly.
Disable accelerated configs in KMSAN builds to prevent false positive
reports.

Signed-off-by: Alexander Potapenko <glider@google.com>
To: Alexander Potapenko <glider@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: linux-mm@kvack.org
---

Change-Id: Iddc71a2a27360e036d719c0940ebf15553cf8de8
---
 crypto/Kconfig | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

Comments

Marco Elver Dec. 2, 2019, 1:25 p.m. UTC | #1
On Fri, 22 Nov 2019 at 12:27, <glider@google.com> wrote:
>
> KMSAN is unable to understand when initialized values come from assembly.
> Disable accelerated configs in KMSAN builds to prevent false positive
> reports.
>
> Signed-off-by: Alexander Potapenko <glider@google.com>
> To: Alexander Potapenko <glider@google.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Vegard Nossum <vegard.nossum@oracle.com>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: linux-mm@kvack.org
> ---
>
> Change-Id: Iddc71a2a27360e036d719c0940ebf15553cf8de8
> ---
>  crypto/Kconfig | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index 9e524044d312..502a75f1b597 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -309,11 +309,15 @@ config CRYPTO_AEGIS128
>  config CRYPTO_AEGIS128_SIMD
>         bool "Support SIMD acceleration for AEGIS-128"
>         depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON)
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN

Probably fine to put this on one line:

    depends on !KMSAN # avoid false positives from assembly

likewise for all below.

>         default y
>
>  config CRYPTO_AEGIS128_AESNI_SSE2
>         tristate "AEGIS-128 AEAD algorithm (x86_64 AESNI+SSE2 implementation)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_AEAD
>         select CRYPTO_SIMD
>         help
> @@ -571,6 +575,8 @@ config CRYPTO_CRC32C
>  config CRYPTO_CRC32C_INTEL
>         tristate "CRC32c INTEL hardware acceleration"
>         depends on X86
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_HASH
>         help
>           In Intel processor with SSE4.2 supported, the processor will
> @@ -611,6 +617,8 @@ config CRYPTO_CRC32
>  config CRYPTO_CRC32_PCLMUL
>         tristate "CRC32 PCLMULQDQ hardware acceleration"
>         depends on X86
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_HASH
>         select CRC32
>         help
> @@ -649,6 +657,8 @@ config CRYPTO_CRCT10DIF
>  config CRYPTO_CRCT10DIF_PCLMUL
>         tristate "CRCT10DIF PCLMULQDQ hardware acceleration"
>         depends on X86 && 64BIT && CRC_T10DIF
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_HASH
>         help
>           For x86_64 processors with SSE4.2 and PCLMULQDQ supported,
> @@ -695,6 +705,8 @@ config CRYPTO_POLY1305
>  config CRYPTO_POLY1305_X86_64
>         tristate "Poly1305 authenticator algorithm (x86_64/SSE2/AVX2)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_POLY1305
>         help
>           Poly1305 authenticator algorithm, RFC7539.
> @@ -814,6 +826,8 @@ config CRYPTO_SHA1
>  config CRYPTO_SHA1_SSSE3
>         tristate "SHA1 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_SHA1
>         select CRYPTO_HASH
>         help
> @@ -825,6 +839,8 @@ config CRYPTO_SHA1_SSSE3
>  config CRYPTO_SHA256_SSSE3
>         tristate "SHA256 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_SHA256
>         select CRYPTO_HASH
>         help
> @@ -837,6 +853,8 @@ config CRYPTO_SHA256_SSSE3
>  config CRYPTO_SHA512_SSSE3
>         tristate "SHA512 digest algorithm (SSSE3/AVX/AVX2)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_SHA512
>         select CRYPTO_HASH
>         help
> @@ -1011,6 +1029,8 @@ config CRYPTO_WP512
>  config CRYPTO_GHASH_CLMUL_NI_INTEL
>         tristate "GHASH hash function (CLMUL-NI accelerated)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_CRYPTD
>         help
>           This is the x86_64 CLMUL-NI accelerated implementation of
> @@ -1064,6 +1084,8 @@ config CRYPTO_AES_TI
>  config CRYPTO_AES_NI_INTEL
>         tristate "AES cipher algorithms (AES-NI)"
>         depends on X86
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_AEAD
>         select CRYPTO_LIB_AES
>         select CRYPTO_ALGAPI
> @@ -1190,6 +1212,8 @@ config CRYPTO_BLOWFISH_COMMON
>  config CRYPTO_BLOWFISH_X86_64
>         tristate "Blowfish cipher algorithm (x86_64)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_BLOWFISH_COMMON
>         help
> @@ -1221,6 +1245,8 @@ config CRYPTO_CAMELLIA_X86_64
>         tristate "Camellia cipher algorithm (x86_64)"
>         depends on X86 && 64BIT
>         depends on CRYPTO
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_GLUE_HELPER_X86
>         help
> @@ -1238,6 +1264,8 @@ config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
>         tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX)"
>         depends on X86 && 64BIT
>         depends on CRYPTO
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_CAMELLIA_X86_64
>         select CRYPTO_GLUE_HELPER_X86
> @@ -1258,6 +1286,8 @@ config CRYPTO_CAMELLIA_AESNI_AVX2_X86_64
>         tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX2)"
>         depends on X86 && 64BIT
>         depends on CRYPTO
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_CAMELLIA_AESNI_AVX_X86_64
>         help
>           Camellia cipher algorithm module (x86_64/AES-NI/AVX2).
> @@ -1303,6 +1333,8 @@ config CRYPTO_CAST5
>  config CRYPTO_CAST5_AVX_X86_64
>         tristate "CAST5 (CAST-128) cipher algorithm (x86_64/AVX)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_CAST5
>         select CRYPTO_CAST_COMMON
> @@ -1325,6 +1357,8 @@ config CRYPTO_CAST6
>  config CRYPTO_CAST6_AVX_X86_64
>         tristate "CAST6 (CAST-256) cipher algorithm (x86_64/AVX)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_CAST6
>         select CRYPTO_CAST_COMMON
> @@ -1360,6 +1394,8 @@ config CRYPTO_DES_SPARC64
>  config CRYPTO_DES3_EDE_X86_64
>         tristate "Triple DES EDE cipher algorithm (x86-64)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_LIB_DES
>         help
> @@ -1426,6 +1462,8 @@ config CRYPTO_CHACHA20
>  config CRYPTO_CHACHA20_X86_64
>         tristate "ChaCha stream cipher algorithms (x86_64/SSSE3/AVX2/AVX-512VL)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_CHACHA20
>         help
> @@ -1462,6 +1500,8 @@ config CRYPTO_SERPENT
>  config CRYPTO_SERPENT_SSE2_X86_64
>         tristate "Serpent cipher algorithm (x86_64/SSE2)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_GLUE_HELPER_X86
>         select CRYPTO_SERPENT
> @@ -1481,6 +1521,8 @@ config CRYPTO_SERPENT_SSE2_X86_64
>  config CRYPTO_SERPENT_SSE2_586
>         tristate "Serpent cipher algorithm (i586/SSE2)"
>         depends on X86 && !64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_GLUE_HELPER_X86
>         select CRYPTO_SERPENT
> @@ -1500,6 +1542,8 @@ config CRYPTO_SERPENT_SSE2_586
>  config CRYPTO_SERPENT_AVX_X86_64
>         tristate "Serpent cipher algorithm (x86_64/AVX)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_GLUE_HELPER_X86
>         select CRYPTO_SERPENT
> @@ -1520,6 +1564,8 @@ config CRYPTO_SERPENT_AVX_X86_64
>  config CRYPTO_SERPENT_AVX2_X86_64
>         tristate "Serpent cipher algorithm (x86_64/AVX2)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_SERPENT_AVX_X86_64
>         help
>           Serpent cipher algorithm, by Anderson, Biham & Knudsen.
> @@ -1615,6 +1661,8 @@ config CRYPTO_TWOFISH_586
>  config CRYPTO_TWOFISH_X86_64
>         tristate "Twofish cipher algorithm (x86_64)"
>         depends on (X86 || UML_X86) && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_ALGAPI
>         select CRYPTO_TWOFISH_COMMON
>         help
> @@ -1631,6 +1679,8 @@ config CRYPTO_TWOFISH_X86_64
>  config CRYPTO_TWOFISH_X86_64_3WAY
>         tristate "Twofish cipher algorithm (x86_64, 3-way parallel)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_TWOFISH_COMMON
>         select CRYPTO_TWOFISH_X86_64
> @@ -1652,6 +1702,8 @@ config CRYPTO_TWOFISH_X86_64_3WAY
>  config CRYPTO_TWOFISH_AVX_X86_64
>         tristate "Twofish cipher algorithm (x86_64/AVX)"
>         depends on X86 && 64BIT
> +       # Disable under KMSAN to prevent false positives from assembly.
> +       depends on !KMSAN
>         select CRYPTO_BLKCIPHER
>         select CRYPTO_GLUE_HELPER_X86
>         select CRYPTO_SIMD
> --
> 2.24.0.432.g9d3f5f5b63-goog
>
Alexander Potapenko Dec. 5, 2019, 2:51 p.m. UTC | #2
On Mon, Dec 2, 2019 at 2:25 PM Marco Elver <elver@google.com> wrote:
>
> On Fri, 22 Nov 2019 at 12:27, <glider@google.com> wrote:
> >
> > KMSAN is unable to understand when initialized values come from assembly.
> > Disable accelerated configs in KMSAN builds to prevent false positive
> > reports.
> >
> > Signed-off-by: Alexander Potapenko <glider@google.com>
> > To: Alexander Potapenko <glider@google.com>
> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: Vegard Nossum <vegard.nossum@oracle.com>
> > Cc: Dmitry Vyukov <dvyukov@google.com>
> > Cc: linux-mm@kvack.org
> > ---
> >
> > Change-Id: Iddc71a2a27360e036d719c0940ebf15553cf8de8
> > ---
> >  crypto/Kconfig | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 52 insertions(+)
> >
> > diff --git a/crypto/Kconfig b/crypto/Kconfig
> > index 9e524044d312..502a75f1b597 100644
> > --- a/crypto/Kconfig
> > +++ b/crypto/Kconfig
> > @@ -309,11 +309,15 @@ config CRYPTO_AEGIS128
> >  config CRYPTO_AEGIS128_SIMD
> >         bool "Support SIMD acceleration for AEGIS-128"
> >         depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON)
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
>
> Probably fine to put this on one line:
>
>     depends on !KMSAN # avoid false positives from assembly
Done in v4.
> likewise for all below.
>
> >         default y
> >
> >  config CRYPTO_AEGIS128_AESNI_SSE2
> >         tristate "AEGIS-128 AEAD algorithm (x86_64 AESNI+SSE2 implementation)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_AEAD
> >         select CRYPTO_SIMD
> >         help
> > @@ -571,6 +575,8 @@ config CRYPTO_CRC32C
> >  config CRYPTO_CRC32C_INTEL
> >         tristate "CRC32c INTEL hardware acceleration"
> >         depends on X86
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_HASH
> >         help
> >           In Intel processor with SSE4.2 supported, the processor will
> > @@ -611,6 +617,8 @@ config CRYPTO_CRC32
> >  config CRYPTO_CRC32_PCLMUL
> >         tristate "CRC32 PCLMULQDQ hardware acceleration"
> >         depends on X86
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_HASH
> >         select CRC32
> >         help
> > @@ -649,6 +657,8 @@ config CRYPTO_CRCT10DIF
> >  config CRYPTO_CRCT10DIF_PCLMUL
> >         tristate "CRCT10DIF PCLMULQDQ hardware acceleration"
> >         depends on X86 && 64BIT && CRC_T10DIF
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_HASH
> >         help
> >           For x86_64 processors with SSE4.2 and PCLMULQDQ supported,
> > @@ -695,6 +705,8 @@ config CRYPTO_POLY1305
> >  config CRYPTO_POLY1305_X86_64
> >         tristate "Poly1305 authenticator algorithm (x86_64/SSE2/AVX2)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_POLY1305
> >         help
> >           Poly1305 authenticator algorithm, RFC7539.
> > @@ -814,6 +826,8 @@ config CRYPTO_SHA1
> >  config CRYPTO_SHA1_SSSE3
> >         tristate "SHA1 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_SHA1
> >         select CRYPTO_HASH
> >         help
> > @@ -825,6 +839,8 @@ config CRYPTO_SHA1_SSSE3
> >  config CRYPTO_SHA256_SSSE3
> >         tristate "SHA256 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_SHA256
> >         select CRYPTO_HASH
> >         help
> > @@ -837,6 +853,8 @@ config CRYPTO_SHA256_SSSE3
> >  config CRYPTO_SHA512_SSSE3
> >         tristate "SHA512 digest algorithm (SSSE3/AVX/AVX2)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_SHA512
> >         select CRYPTO_HASH
> >         help
> > @@ -1011,6 +1029,8 @@ config CRYPTO_WP512
> >  config CRYPTO_GHASH_CLMUL_NI_INTEL
> >         tristate "GHASH hash function (CLMUL-NI accelerated)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_CRYPTD
> >         help
> >           This is the x86_64 CLMUL-NI accelerated implementation of
> > @@ -1064,6 +1084,8 @@ config CRYPTO_AES_TI
> >  config CRYPTO_AES_NI_INTEL
> >         tristate "AES cipher algorithms (AES-NI)"
> >         depends on X86
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_AEAD
> >         select CRYPTO_LIB_AES
> >         select CRYPTO_ALGAPI
> > @@ -1190,6 +1212,8 @@ config CRYPTO_BLOWFISH_COMMON
> >  config CRYPTO_BLOWFISH_X86_64
> >         tristate "Blowfish cipher algorithm (x86_64)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_BLOWFISH_COMMON
> >         help
> > @@ -1221,6 +1245,8 @@ config CRYPTO_CAMELLIA_X86_64
> >         tristate "Camellia cipher algorithm (x86_64)"
> >         depends on X86 && 64BIT
> >         depends on CRYPTO
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_GLUE_HELPER_X86
> >         help
> > @@ -1238,6 +1264,8 @@ config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
> >         tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX)"
> >         depends on X86 && 64BIT
> >         depends on CRYPTO
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_CAMELLIA_X86_64
> >         select CRYPTO_GLUE_HELPER_X86
> > @@ -1258,6 +1286,8 @@ config CRYPTO_CAMELLIA_AESNI_AVX2_X86_64
> >         tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX2)"
> >         depends on X86 && 64BIT
> >         depends on CRYPTO
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_CAMELLIA_AESNI_AVX_X86_64
> >         help
> >           Camellia cipher algorithm module (x86_64/AES-NI/AVX2).
> > @@ -1303,6 +1333,8 @@ config CRYPTO_CAST5
> >  config CRYPTO_CAST5_AVX_X86_64
> >         tristate "CAST5 (CAST-128) cipher algorithm (x86_64/AVX)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_CAST5
> >         select CRYPTO_CAST_COMMON
> > @@ -1325,6 +1357,8 @@ config CRYPTO_CAST6
> >  config CRYPTO_CAST6_AVX_X86_64
> >         tristate "CAST6 (CAST-256) cipher algorithm (x86_64/AVX)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_CAST6
> >         select CRYPTO_CAST_COMMON
> > @@ -1360,6 +1394,8 @@ config CRYPTO_DES_SPARC64
> >  config CRYPTO_DES3_EDE_X86_64
> >         tristate "Triple DES EDE cipher algorithm (x86-64)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_LIB_DES
> >         help
> > @@ -1426,6 +1462,8 @@ config CRYPTO_CHACHA20
> >  config CRYPTO_CHACHA20_X86_64
> >         tristate "ChaCha stream cipher algorithms (x86_64/SSSE3/AVX2/AVX-512VL)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_CHACHA20
> >         help
> > @@ -1462,6 +1500,8 @@ config CRYPTO_SERPENT
> >  config CRYPTO_SERPENT_SSE2_X86_64
> >         tristate "Serpent cipher algorithm (x86_64/SSE2)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_GLUE_HELPER_X86
> >         select CRYPTO_SERPENT
> > @@ -1481,6 +1521,8 @@ config CRYPTO_SERPENT_SSE2_X86_64
> >  config CRYPTO_SERPENT_SSE2_586
> >         tristate "Serpent cipher algorithm (i586/SSE2)"
> >         depends on X86 && !64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_GLUE_HELPER_X86
> >         select CRYPTO_SERPENT
> > @@ -1500,6 +1542,8 @@ config CRYPTO_SERPENT_SSE2_586
> >  config CRYPTO_SERPENT_AVX_X86_64
> >         tristate "Serpent cipher algorithm (x86_64/AVX)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_GLUE_HELPER_X86
> >         select CRYPTO_SERPENT
> > @@ -1520,6 +1564,8 @@ config CRYPTO_SERPENT_AVX_X86_64
> >  config CRYPTO_SERPENT_AVX2_X86_64
> >         tristate "Serpent cipher algorithm (x86_64/AVX2)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_SERPENT_AVX_X86_64
> >         help
> >           Serpent cipher algorithm, by Anderson, Biham & Knudsen.
> > @@ -1615,6 +1661,8 @@ config CRYPTO_TWOFISH_586
> >  config CRYPTO_TWOFISH_X86_64
> >         tristate "Twofish cipher algorithm (x86_64)"
> >         depends on (X86 || UML_X86) && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_ALGAPI
> >         select CRYPTO_TWOFISH_COMMON
> >         help
> > @@ -1631,6 +1679,8 @@ config CRYPTO_TWOFISH_X86_64
> >  config CRYPTO_TWOFISH_X86_64_3WAY
> >         tristate "Twofish cipher algorithm (x86_64, 3-way parallel)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_TWOFISH_COMMON
> >         select CRYPTO_TWOFISH_X86_64
> > @@ -1652,6 +1702,8 @@ config CRYPTO_TWOFISH_X86_64_3WAY
> >  config CRYPTO_TWOFISH_AVX_X86_64
> >         tristate "Twofish cipher algorithm (x86_64/AVX)"
> >         depends on X86 && 64BIT
> > +       # Disable under KMSAN to prevent false positives from assembly.
> > +       depends on !KMSAN
> >         select CRYPTO_BLKCIPHER
> >         select CRYPTO_GLUE_HELPER_X86
> >         select CRYPTO_SIMD
> > --
> > 2.24.0.432.g9d3f5f5b63-goog
> >
diff mbox series

Patch

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 9e524044d312..502a75f1b597 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -309,11 +309,15 @@  config CRYPTO_AEGIS128
 config CRYPTO_AEGIS128_SIMD
 	bool "Support SIMD acceleration for AEGIS-128"
 	depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON)
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	default y
 
 config CRYPTO_AEGIS128_AESNI_SSE2
 	tristate "AEGIS-128 AEAD algorithm (x86_64 AESNI+SSE2 implementation)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_AEAD
 	select CRYPTO_SIMD
 	help
@@ -571,6 +575,8 @@  config CRYPTO_CRC32C
 config CRYPTO_CRC32C_INTEL
 	tristate "CRC32c INTEL hardware acceleration"
 	depends on X86
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_HASH
 	help
 	  In Intel processor with SSE4.2 supported, the processor will
@@ -611,6 +617,8 @@  config CRYPTO_CRC32
 config CRYPTO_CRC32_PCLMUL
 	tristate "CRC32 PCLMULQDQ hardware acceleration"
 	depends on X86
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_HASH
 	select CRC32
 	help
@@ -649,6 +657,8 @@  config CRYPTO_CRCT10DIF
 config CRYPTO_CRCT10DIF_PCLMUL
 	tristate "CRCT10DIF PCLMULQDQ hardware acceleration"
 	depends on X86 && 64BIT && CRC_T10DIF
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_HASH
 	help
 	  For x86_64 processors with SSE4.2 and PCLMULQDQ supported,
@@ -695,6 +705,8 @@  config CRYPTO_POLY1305
 config CRYPTO_POLY1305_X86_64
 	tristate "Poly1305 authenticator algorithm (x86_64/SSE2/AVX2)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_POLY1305
 	help
 	  Poly1305 authenticator algorithm, RFC7539.
@@ -814,6 +826,8 @@  config CRYPTO_SHA1
 config CRYPTO_SHA1_SSSE3
 	tristate "SHA1 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_SHA1
 	select CRYPTO_HASH
 	help
@@ -825,6 +839,8 @@  config CRYPTO_SHA1_SSSE3
 config CRYPTO_SHA256_SSSE3
 	tristate "SHA256 digest algorithm (SSSE3/AVX/AVX2/SHA-NI)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_SHA256
 	select CRYPTO_HASH
 	help
@@ -837,6 +853,8 @@  config CRYPTO_SHA256_SSSE3
 config CRYPTO_SHA512_SSSE3
 	tristate "SHA512 digest algorithm (SSSE3/AVX/AVX2)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_SHA512
 	select CRYPTO_HASH
 	help
@@ -1011,6 +1029,8 @@  config CRYPTO_WP512
 config CRYPTO_GHASH_CLMUL_NI_INTEL
 	tristate "GHASH hash function (CLMUL-NI accelerated)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_CRYPTD
 	help
 	  This is the x86_64 CLMUL-NI accelerated implementation of
@@ -1064,6 +1084,8 @@  config CRYPTO_AES_TI
 config CRYPTO_AES_NI_INTEL
 	tristate "AES cipher algorithms (AES-NI)"
 	depends on X86
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_AEAD
 	select CRYPTO_LIB_AES
 	select CRYPTO_ALGAPI
@@ -1190,6 +1212,8 @@  config CRYPTO_BLOWFISH_COMMON
 config CRYPTO_BLOWFISH_X86_64
 	tristate "Blowfish cipher algorithm (x86_64)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_BLOWFISH_COMMON
 	help
@@ -1221,6 +1245,8 @@  config CRYPTO_CAMELLIA_X86_64
 	tristate "Camellia cipher algorithm (x86_64)"
 	depends on X86 && 64BIT
 	depends on CRYPTO
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_GLUE_HELPER_X86
 	help
@@ -1238,6 +1264,8 @@  config CRYPTO_CAMELLIA_AESNI_AVX_X86_64
 	tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX)"
 	depends on X86 && 64BIT
 	depends on CRYPTO
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_CAMELLIA_X86_64
 	select CRYPTO_GLUE_HELPER_X86
@@ -1258,6 +1286,8 @@  config CRYPTO_CAMELLIA_AESNI_AVX2_X86_64
 	tristate "Camellia cipher algorithm (x86_64/AES-NI/AVX2)"
 	depends on X86 && 64BIT
 	depends on CRYPTO
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_CAMELLIA_AESNI_AVX_X86_64
 	help
 	  Camellia cipher algorithm module (x86_64/AES-NI/AVX2).
@@ -1303,6 +1333,8 @@  config CRYPTO_CAST5
 config CRYPTO_CAST5_AVX_X86_64
 	tristate "CAST5 (CAST-128) cipher algorithm (x86_64/AVX)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_CAST5
 	select CRYPTO_CAST_COMMON
@@ -1325,6 +1357,8 @@  config CRYPTO_CAST6
 config CRYPTO_CAST6_AVX_X86_64
 	tristate "CAST6 (CAST-256) cipher algorithm (x86_64/AVX)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_CAST6
 	select CRYPTO_CAST_COMMON
@@ -1360,6 +1394,8 @@  config CRYPTO_DES_SPARC64
 config CRYPTO_DES3_EDE_X86_64
 	tristate "Triple DES EDE cipher algorithm (x86-64)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_LIB_DES
 	help
@@ -1426,6 +1462,8 @@  config CRYPTO_CHACHA20
 config CRYPTO_CHACHA20_X86_64
 	tristate "ChaCha stream cipher algorithms (x86_64/SSSE3/AVX2/AVX-512VL)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_CHACHA20
 	help
@@ -1462,6 +1500,8 @@  config CRYPTO_SERPENT
 config CRYPTO_SERPENT_SSE2_X86_64
 	tristate "Serpent cipher algorithm (x86_64/SSE2)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_GLUE_HELPER_X86
 	select CRYPTO_SERPENT
@@ -1481,6 +1521,8 @@  config CRYPTO_SERPENT_SSE2_X86_64
 config CRYPTO_SERPENT_SSE2_586
 	tristate "Serpent cipher algorithm (i586/SSE2)"
 	depends on X86 && !64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_GLUE_HELPER_X86
 	select CRYPTO_SERPENT
@@ -1500,6 +1542,8 @@  config CRYPTO_SERPENT_SSE2_586
 config CRYPTO_SERPENT_AVX_X86_64
 	tristate "Serpent cipher algorithm (x86_64/AVX)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_GLUE_HELPER_X86
 	select CRYPTO_SERPENT
@@ -1520,6 +1564,8 @@  config CRYPTO_SERPENT_AVX_X86_64
 config CRYPTO_SERPENT_AVX2_X86_64
 	tristate "Serpent cipher algorithm (x86_64/AVX2)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_SERPENT_AVX_X86_64
 	help
 	  Serpent cipher algorithm, by Anderson, Biham & Knudsen.
@@ -1615,6 +1661,8 @@  config CRYPTO_TWOFISH_586
 config CRYPTO_TWOFISH_X86_64
 	tristate "Twofish cipher algorithm (x86_64)"
 	depends on (X86 || UML_X86) && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_ALGAPI
 	select CRYPTO_TWOFISH_COMMON
 	help
@@ -1631,6 +1679,8 @@  config CRYPTO_TWOFISH_X86_64
 config CRYPTO_TWOFISH_X86_64_3WAY
 	tristate "Twofish cipher algorithm (x86_64, 3-way parallel)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_TWOFISH_COMMON
 	select CRYPTO_TWOFISH_X86_64
@@ -1652,6 +1702,8 @@  config CRYPTO_TWOFISH_X86_64_3WAY
 config CRYPTO_TWOFISH_AVX_X86_64
 	tristate "Twofish cipher algorithm (x86_64/AVX)"
 	depends on X86 && 64BIT
+	# Disable under KMSAN to prevent false positives from assembly.
+	depends on !KMSAN
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_GLUE_HELPER_X86
 	select CRYPTO_SIMD