public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Fix excessive TLS use (#1722181)
@ 2026-11-23  9:32 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:32 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rpm
Branch : pmatilai-v6
Commit : 894aa7a821710401bb00de8597726c9658b3ad11
Author : Panu Matilainen <pmatilai@redhat.com>
Date   : 2019-06-20T14:00:13+03:00
Stats  : +52/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rpm/c/894aa7a821710401bb00de8597726c9658b3ad11?branch=pmatilai-v6

Log:
Fix excessive TLS use (#1722181)

---
diff --git a/0001-Don-t-hog-thread-local-storage-it-s-a-scarce-resourc.patch b/0001-Don-t-hog-thread-local-storage-it-s-a-scarce-resourc.patch
new file mode 100644
index 0000000..fdf0ad5
--- /dev/null
+++ b/0001-Don-t-hog-thread-local-storage-it-s-a-scarce-resourc.patch
@@ -0,0 +1,46 @@
+From bc79f3533882dfcffb4dd018e2d1a56691c99248 Mon Sep 17 00:00:00 2001
+Message-Id: <bc79f3533882dfcffb4dd018e2d1a56691c99248.1561028242.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Thu, 20 Jun 2019 13:50:23 +0300
+Subject: [PATCH] Don't hog thread local storage, it's a scarce resource
+ (RhBug:1722181)
+
+Commit 6487e873f3169c2bffbd52808b6c749e6c104ff5 introduced a thread local
+BUFSIZ static buffer for header format error reporting but thread local
+storage is apparently a rather scarce resource (on some architectures
+more so than others) and this is highly excessive use of that resource.
+Use a thread local pointer to dynamically (re)allocated buffer instead.
+---
+ lib/headerfmt.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/lib/headerfmt.c b/lib/headerfmt.c
+index 1f6390b5e..7c0da1bd9 100644
+--- a/lib/headerfmt.c
++++ b/lib/headerfmt.c
+@@ -221,18 +221,18 @@ static char * hsaReserve(headerSprintfArgs hsa, size_t need)
+ RPM_GNUC_PRINTF(2, 3)
+ static void hsaError(headerSprintfArgs hsa, const char *fmt, ...)
+ {
+-    /* Use thread local static buffer as headerFormat() errmsg arg is const */
+-    static __thread char errbuf[BUFSIZ];
++    /* Use thread local buffer as headerFormat() errmsg arg is const */
++    static __thread char *errbuf = NULL;
+ 
+     if (fmt == NULL) {
+ 	hsa->errmsg = NULL;
+     } else {
+ 	va_list ap;
+ 
++	free(errbuf);
+ 	va_start(ap, fmt);
+-	vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
++	rvasprintf(&errbuf, fmt, ap);
+ 	va_end(ap);
+-
+ 	hsa->errmsg = errbuf;
+     }
+ }
+-- 
+2.21.0
+

diff --git a/rpm.spec b/rpm.spec
index 43da115..4298587 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
 
 %global rpmver 4.14.90
 %global snapver git14653
-%global rel 16
+%global rel 17
 
 %global srcver %{version}%{?snapver:-%{snapver}}
 %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@@ -56,6 +56,8 @@ Patch100: 0001-Only-permit-one-thread-at-a-time-in-addFileToTag.patch
 # https://github.com/rpm-software-management/rpm/pull/745
 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
 
 # These are not yet upstream
 Patch906: rpm-4.7.1-geode-i686.patch
@@ -542,6 +544,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.17
+- Fix excessive TLS use (#1722181)
+
 * Wed Jun 19 2019 Panu Matilainen <pmatilai@redhat.com> - 4.14.90-0.git14653.16
 - Drop buildarch again now that python_provide no longer needs it (#1720139)
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:32 [rpms/rpm] pmatilai-v6: Fix excessive TLS use (#1722181) Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox