Fix excessive TLS use, part II (#1722181)

This commit is contained in:
Panu Matilainen 2019-06-20 15:15:06 +03:00
parent 894aa7a821
commit 70d62ac48f
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From b39bd1965ed2fdeadb427648ec7e911613c8398f Mon Sep 17 00:00:00 2001
Message-Id: <b39bd1965ed2fdeadb427648ec7e911613c8398f.1561032722.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 20 Jun 2019 15:07:12 +0300
Subject: [PATCH] Fix excessive use of thread local storage (RhBug:1722181),
part II
This essentially reverts commit ff43d03d1f9686c9ffa9232a64e253783309feb5
which made these all thread local. It might not be quite right, but then
using TLS is not sensible either - threads have their own signal *mask*,
but disposition is global, and most of what we do here is global anyway.
In addition, the signal queue is only enabled in places where threads
are not used (or would not be safe anyhow) so reverting for now seems
the lesser evil.
---
rpmio/rpmsq.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/rpmio/rpmsq.c b/rpmio/rpmsq.c
index d157514e9..249a204b3 100644
--- a/rpmio/rpmsq.c
+++ b/rpmio/rpmsq.c
@@ -16,9 +16,9 @@
#include "debug.h"
-static __thread int disableInterruptSafety;
-static __thread sigset_t rpmsqCaught;
-static __thread sigset_t rpmsqActive;
+static int disableInterruptSafety;
+static sigset_t rpmsqCaught;
+static sigset_t rpmsqActive;
typedef struct rpmsig_s * rpmsig;
@@ -171,8 +171,8 @@ int rpmsqPoll(void)
int rpmsqBlock(int op)
{
- static __thread sigset_t oldMask;
- static __thread int blocked = 0;
+ static sigset_t oldMask;
+ static int blocked = 0;
sigset_t newMask;
int ret = 0;
--
2.21.0

View File

@ -21,7 +21,7 @@
%global rpmver 4.14.90
%global snapver git14653
%global rel 17
%global rel 18
%global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -58,6 +58,7 @@ Patch101: 0001-build-Limit-copying-changelog-one-at-a-time.patch
Patch102: 0001-Don-t-fail-build-trying-to-kill-a-non-existent-proce.patch
# https://github.com/rpm-software-management/rpm/pull/759
Patch103: 0001-Don-t-hog-thread-local-storage-it-s-a-scarce-resourc.patch
Patch104: 0001-Fix-excessive-use-of-thread-local-storage-RhBug-1722.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@ -544,6 +545,9 @@ make check || (cat tests/rpmtests.log; exit 0)
%doc doc/librpm/html/*
%changelog
* Thu Jun 20 2019 Panu Matilainen <pmatilai@redhat.com> - 4.14.90-0.git14653.18
- Fix excessive TLS use, part II (#1722181)
* Thu Jun 20 2019 Panu Matilainen <pmatilai@redhat.com> - 4.14.90-0.git14653.17
- Fix excessive TLS use (#1722181)