ANDROID: fix alignment of struct shash_desc member

Prior to a recent patch series the alignment of struct shash_desc's
trailing zero-length array member __ctx was 16 bytes. Textually, this
was represented as "(((16UL)))" due to the following macro
definitions:

 #define __AC(X,Y)       (X##Y)
 #define _AC(X,Y)        __AC(X,Y)
 #define _UL(x)          (_AC(x, UL))
 #define UL(x)           (_UL(x))
 #define MTE_GRANULE_SIZE       UL(16)
 #define ARCH_SLAB_MINALIGN     MTE_GRANULE_SIZE

The series removed the definition in terms of MTE_GRANULE_SIZE
resulting in a fallback value (8 bytes on ARM 64) being used instead:

 #ifndef ARCH_SLAB_MINALIGN
 #define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
 #endif

So there were size, alignment and symtypes changes, breaking ABI
compatibility.

This change corrects all issues, but possibly not in the best way.

Fixes: de23208aef7069b2 ("BACKPORT: mm: make minimum slab alignment a runtime property")
Bug: 238956478
Change-Id: If8eecad25ab662c5194f8cb6fe7e356e4173a030
Signed-off-by: Giuliano Procida <gprocida@google.com>
This commit is contained in:
Giuliano Procida
2022-09-09 18:04:41 +01:00
committed by Suren Baghdasaryan
parent e15184fefe
commit 587cfd8e66

View File

@@ -149,7 +149,7 @@ struct ahash_alg {
struct shash_desc {
struct crypto_shash *tfm;
void *__ctx[] __aligned(ARCH_SLAB_MINALIGN);
void *__ctx[] __aligned(UL(16));
};
#define HASH_MAX_DIGESTSIZE 64