Revert patch that uses pthread_once()
Apparently it's not available in F31.
This commit is contained in:
parent
4866d64405
commit
54dfd2376d
2 changed files with 64 additions and 0 deletions
|
|
@ -0,0 +1,63 @@
|
|||
From de646878d39a184d3e5ecac5e49fac63b5d27dbf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
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 <errno.h>
|
||||
-#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "strv.h"
|
||||
|
||||
#if ENABLE_DEBUG_HASHMAP
|
||||
+#include <pthread.h>
|
||||
#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;
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue