diff --git a/0001-Revert-hashmap-make-sure-to-initialize-shared-hash-k.patch b/0001-Revert-hashmap-make-sure-to-initialize-shared-hash-k.patch new file mode 100644 index 0000000..e69a3a4 --- /dev/null +++ b/0001-Revert-hashmap-make-sure-to-initialize-shared-hash-k.patch @@ -0,0 +1,63 @@ +From de646878d39a184d3e5ecac5e49fac63b5d27dbf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 20 Sep 2020 14:37:39 +0200 +Subject: [PATCH] Revert "hashmap: make sure to initialize shared hash key + atomically" + +This reverts commit df14a160095987140f4435412156a80ec628fd7c. +--- + src/basic/hashmap.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c +index 64fbad1969..3bd94a1320 100644 +--- a/src/basic/hashmap.c ++++ b/src/basic/hashmap.c +@@ -1,7 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + + #include +-#include + #include + #include + #include +@@ -21,6 +20,7 @@ + #include "strv.h" + + #if ENABLE_DEBUG_HASHMAP ++#include + #include "list.h" + #endif + +@@ -195,6 +195,7 @@ assert_cc(DIRECT_BUCKETS(struct set_entry) < (1 << 3)); + * a handful of directly stored entries in a hashmap. When a hashmap + * outgrows direct storage, it gets its own key for indirect storage. */ + static uint8_t shared_hash_key[HASH_KEY_SIZE]; ++static bool shared_hash_key_initialized; + + /* Fields that all hashmap/set types must have */ + struct HashmapBase { +@@ -770,10 +771,6 @@ static void reset_direct_storage(HashmapBase *h) { + memset(p, DIB_RAW_INIT, sizeof(dib_raw_t) * hi->n_direct_buckets); + } + +-static void shared_hash_key_initialize(void) { +- random_bytes(shared_hash_key, sizeof(shared_hash_key)); +-} +- + static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) { + HashmapBase *h; + const struct hashmap_type_info *hi = &hashmap_type_info[type]; +@@ -796,8 +793,10 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu + + reset_direct_storage(h); + +- static pthread_once_t once = PTHREAD_ONCE_INIT; +- assert_se(pthread_once(&once, shared_hash_key_initialize) == 0); ++ if (!shared_hash_key_initialized) { ++ random_bytes(shared_hash_key, sizeof(shared_hash_key)); ++ shared_hash_key_initialized= true; ++ } + + #if ENABLE_DEBUG_HASHMAP + h->debug.func = func; diff --git a/systemd.spec b/systemd.spec index c895a4f..0b59e01 100644 --- a/systemd.spec +++ b/systemd.spec @@ -64,6 +64,7 @@ Patch0900: 0002-Revert-units-set-NoNewPrivileges-for-all-long-runnin.patch Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch Patch0009: https://github.com/systemd/systemd/pull/17050/commits/f58b96d3e8d1cb0dd3666bc74fa673918b586612.patch +Patch0010: 0001-Revert-hashmap-make-sure-to-initialize-shared-hash-k.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1