From 1b0760a0e536d61a93124262a3330e9bdc0bdead Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 9 Mar 2021 13:51:12 +0100 Subject: [PATCH] Revert "crypto - shash: reduce minimum alignment of shash_desc structure" This reverts commit 078170924d84fe8f695eece167541f642da629c5 which is commit 660d2062190db131d2feaf19914e90f868fe285c uptream. It messes with the ABI and doesn't fix anything specific, so leave it out for now. Bug: 161946584 Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman Change-Id: I1a0716fdbdc2e550f2a80d742585bd7100776f4e --- include/crypto/hash.h | 8 ++++---- include/linux/crypto.h | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/crypto/hash.h b/include/crypto/hash.h index 84e9f2380edf..d52b95b75ae4 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -141,7 +141,7 @@ struct ahash_alg { struct shash_desc { struct crypto_shash *tfm; - void *__ctx[] __aligned(ARCH_SLAB_MINALIGN); + void *__ctx[] CRYPTO_MINALIGN_ATTR; }; #define HASH_MAX_DIGESTSIZE 64 @@ -154,9 +154,9 @@ struct shash_desc { #define HASH_MAX_STATESIZE 512 -#define SHASH_DESC_ON_STACK(shash, ctx) \ - char __##shash##_desc[sizeof(struct shash_desc) + HASH_MAX_DESCSIZE] \ - __aligned(__alignof__(struct shash_desc)); \ +#define SHASH_DESC_ON_STACK(shash, ctx) \ + char __##shash##_desc[sizeof(struct shash_desc) + \ + HASH_MAX_DESCSIZE] CRYPTO_MINALIGN_ATTR; \ struct shash_desc *shash = (struct shash_desc *)__##shash##_desc /** diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 0c720a2982ae..19ea3a371d7b 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -130,12 +130,9 @@ * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual * declaration) is used to ensure that the crypto_tfm context structure is * aligned correctly for the given architecture so that there are no alignment - * faults for C data types. On architectures that support non-cache coherent - * DMA, such as ARM or arm64, it also takes into account the minimal alignment - * that is required to ensure that the context struct member does not share any - * cachelines with the rest of the struct. This is needed to ensure that cache - * maintenance for non-coherent DMA (cache invalidation in particular) does not - * affect data that may be accessed by the CPU concurrently. + * faults for C data types. In particular, this is required on platforms such + * as arm where pointers are 32-bit aligned but there are data types such as + * u64 which require 64-bit alignment. */ #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN