]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Ensure entries in the neighborhood struct are 8 byte aligned
authorNeil Horman <nhorman@openssl.org>
Fri, 6 Mar 2026 16:31:16 +0000 (11:31 -0500)
committerNeil Horman <nhorman@openssl.org>
Tue, 10 Mar 2026 18:18:36 +0000 (14:18 -0400)
This struct is accessed via atomics, which on some platforms require 8
byte alignment.  Generally compilers provide that alignment, since the
first element of the struct is a uint64_t, but it appears that not all
do.

Force the alignment to be correct

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 10 18:16:34 2026
(Merged from https://github.com/openssl/openssl/pull/30293)

(cherry picked from commit a743be6d2d3f8b2eaebe7ff933f27b1e74cfebe5)

crypto/hashtable/hashtable.c

index 10dda82a7479c9c1dd5ade50f55585196ea62193..af800c2cdf9e072ab42d8b1bebc166a1348d9581 100644 (file)
 #if defined(__GNUC__) || defined(__CLANG__)
 #define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
 #define PREFETCH(x) __builtin_prefetch(x)
+#define ALIGN __attribute__((aligned(8)))
 #else
 #define PREFETCH_NEIGHBORHOOD(x)
 #define PREFETCH(x)
+#define ALIGN
 #endif
 
 /*
@@ -111,7 +113,7 @@ struct ht_internal_value_st {
 struct ht_neighborhood_entry_st {
     uint64_t hash;
     struct ht_internal_value_st *value;
-};
+} ALIGN;
 
 struct ht_neighborhood_st {
     struct ht_neighborhood_entry_st entries[NEIGHBORHOOD_LEN];