Commit a743be6d2d for openssl.org
commit a743be6d2d3f8b2eaebe7ff933f27b1e74cfebe5
Author: Neil Horman <nhorman@openssl.org>
Date: Fri Mar 6 11:31:16 2026 -0500
Ensure entries in the neighborhood struct are 8 byte aligned
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)
diff --git a/crypto/hashtable/hashtable.c b/crypto/hashtable/hashtable.c
index 10dda82a74..af800c2cdf 100644
--- a/crypto/hashtable/hashtable.c
+++ b/crypto/hashtable/hashtable.c
@@ -81,9 +81,11 @@
#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];