public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rr] epel10.3: Resolves: rhbz1987924
@ 2026-11-10 21:34 William Cohen
0 siblings, 0 replies; only message in thread
From: William Cohen @ 2026-11-10 21:34 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rr
Branch : epel10.3
Commit : fdfbfd0474af6f575bcd6c83a6cd14d7bdb9a188
Author : William Cohen <wcohen@redhat.com>
Date : 2021-07-29T15:32:20-04:00
Stats : +250/-1 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/rr/c/fdfbfd0474af6f575bcd6c83a6cd14d7bdb9a188?branch=epel10.3
Log:
Resolves: rhbz1987924
---
diff --git a/rr-pthread_mutex.patch b/rr-pthread_mutex.patch
new file mode 100644
index 0000000..d378311
--- /dev/null
+++ b/rr-pthread_mutex.patch
@@ -0,0 +1,82 @@
+commit 0044772ce90ab65ef8a6daca35bb1cb1c4768a87
+Author: Robert O'Callahan <robert@ocallahan.org>
+Date: Tue Jul 13 12:05:31 2021 +1200
+
+ Support glibc 2.34 where __pthread_mutex_(try)lock does not exist
+
+ Resolves #2913
+
+diff --git a/src/preload/overrides.c b/src/preload/overrides.c
+index 74daf0e6..585d7299 100644
+--- a/src/preload/overrides.c
++++ b/src/preload/overrides.c
+@@ -19,11 +19,21 @@
+
+ #define PTHREAD_MUTEX_PRIO_INHERIT_NP 32
+
++#define DOUBLE_UNDERSCORE_PTHREAD_LOCK_AVAILABLE 1
++#ifdef __GLIBC_PREREQ
++#if __GLIBC_PREREQ(2, 34)
++#undef DOUBLE_UNDERSCORE_PTHREAD_LOCK_AVAILABLE
++#endif
++#endif
++
+ static void fix_mutex_kind(pthread_mutex_t* mutex) {
+ /* Disable priority inheritance. */
+ mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
+ }
+
++extern int __pthread_mutex_init(pthread_mutex_t* mutex,
++ const pthread_mutexattr_t* attr);
++#ifdef DOUBLE_UNDERSCORE_PTHREAD_LOCK_AVAILABLE
+ /*
+ * We need to able to call directly to __pthread_mutex_lock and
+ * __pthread_mutex_trylock because setting up indirect function pointers
+@@ -32,10 +42,9 @@ static void fix_mutex_kind(pthread_mutex_t* mutex) {
+ * to use a pthreads-based implementation). So before our pointers are set
+ * up, call these.
+ */
+-extern int __pthread_mutex_init(pthread_mutex_t* mutex,
+- const pthread_mutexattr_t* attr);
+ extern int __pthread_mutex_lock(pthread_mutex_t* mutex);
+ extern int __pthread_mutex_trylock(pthread_mutex_t* mutex);
++#endif
+
+ int pthread_mutex_init(pthread_mutex_t* mutex,
+ const pthread_mutexattr_t* attr) {
+@@ -68,10 +77,14 @@ int pthread_mutex_init(pthread_mutex_t* mutex,
+ are later rolled back if the transaction fails. */
+ int pthread_mutex_lock(pthread_mutex_t* mutex) {
+ fix_mutex_kind(mutex);
+- if (real_pthread_mutex_lock) {
+- return real_pthread_mutex_lock(mutex);
++ if (!real_pthread_mutex_lock) {
++#ifdef DOUBLE_UNDERSCORE_PTHREAD_LOCK_AVAILABLE
++ return __pthread_mutex_lock(mutex);
++#else
++ real_pthread_mutex_lock = dlsym(RTLD_NEXT, "pthread_mutex_lock");
++#endif
+ }
+- return __pthread_mutex_lock(mutex);
++ return real_pthread_mutex_lock(mutex);
+ }
+
+ int pthread_mutex_timedlock(pthread_mutex_t* mutex,
+@@ -88,10 +101,14 @@ int pthread_mutex_timedlock(pthread_mutex_t* mutex,
+
+ int pthread_mutex_trylock(pthread_mutex_t* mutex) {
+ fix_mutex_kind(mutex);
+- if (real_pthread_mutex_trylock) {
+- return real_pthread_mutex_trylock(mutex);
++ if (!real_pthread_mutex_trylock) {
++#ifdef DOUBLE_UNDERSCORE_PTHREAD_LOCK_AVAILABLE
++ return __pthread_mutex_trylock(mutex);
++#else
++ real_pthread_mutex_trylock = dlsym(RTLD_NEXT, "pthread_mutex_trylock");
++#endif
+ }
+- return __pthread_mutex_trylock(mutex);
++ return real_pthread_mutex_trylock(mutex);
+ }
+
+ /**
diff --git a/rr-pthread_mutex0.patch b/rr-pthread_mutex0.patch
new file mode 100644
index 0000000..d551992
--- /dev/null
+++ b/rr-pthread_mutex0.patch
@@ -0,0 +1,124 @@
+commit 15bc3f0471cbe513cd47318cbae8ee36d6132b73
+Author: Michael Davidsaver <mdavidsaver@gmail.com>
+Date: Wed Nov 25 22:44:05 2020 -0800
+
+ Override pthread_mutex_init() to force PTHREAD_PRIO_NONE
+
+ When PTHREAD_PRIO_INHERIT is set, pthread_mutex_init() from glibc
+ performs a test futex() call to probe for OS support. This fails
+ with RR. Workaround by forcing PTHREAD_PRIO_NONE.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 83dced79..ae0dd823 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -944,6 +944,7 @@ set(BASIC_TESTS
+ pid_ns_reap
+ pid_ns_segv
+ pidfd
++ pthread_pi_mutex
+ pthread_rwlocks
+ poll_sig_race
+ ppoll
+diff --git a/src/preload/overrides.c b/src/preload/overrides.c
+index ff672709..bbc4189d 100644
+--- a/src/preload/overrides.c
++++ b/src/preload/overrides.c
+@@ -10,6 +10,7 @@
+ #include <pthread.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+
+@@ -31,9 +32,33 @@ static void fix_mutex_kind(pthread_mutex_t* mutex) {
+ * to use a pthreads-based implementation). So before our pointers are set
+ * up, call these.
+ */
++extern int __pthread_mutex_init(pthread_mutex_t* mutex,
++ const pthread_mutexattr_t* attr);
+ extern int __pthread_mutex_lock(pthread_mutex_t* mutex);
+ extern int __pthread_mutex_trylock(pthread_mutex_t* mutex);
+
++int pthread_mutex_init(pthread_mutex_t* mutex,
++ const pthread_mutexattr_t* attr) {
++ int ret;
++ pthread_mutexattr_t realattr;
++
++ /* We wish to enforce the use of plain (no PI) mutex to avoid
++ * needing to handle PI futex() operations.
++ * We also wish to ensure that pthread_mutexattr_getprotocol()
++ * still returns the requested protocol.
++ * So we copy the attribute and force PTHREAD_PRIO_NONE.
++ */
++ memcpy(&realattr, &attr, sizeof(realattr));
++ ret = pthread_mutexattr_setprotocol(&realattr, PTHREAD_PRIO_NONE);
++ if (ret) {
++ return ret;
++ }
++ if (real_pthread_mutex_init) {
++ return real_pthread_mutex_init(mutex, &realattr);
++ }
++ return __pthread_mutex_init(mutex, &realattr);
++}
++
+ /* Prevent use of lock elision; Haswell's TSX/RTM features used by
+ lock elision increment the rbc perf counter for instructions which
+ are later rolled back if the transaction fails. */
+diff --git a/src/preload/syscallbuf.c b/src/preload/syscallbuf.c
+index 42326406..2c03b393 100644
+--- a/src/preload/syscallbuf.c
++++ b/src/preload/syscallbuf.c
+@@ -143,6 +143,7 @@ static int process_inited;
+ RR_HIDDEN struct preload_globals globals;
+ RR_HIDDEN char impose_syscall_delay;
+ RR_HIDDEN char impose_spurious_desched;
++RR_HIDDEN int (*real_pthread_mutex_init)(void* mutex, const void* attr);
+ RR_HIDDEN int (*real_pthread_mutex_lock)(void* mutex);
+ RR_HIDDEN int (*real_pthread_mutex_trylock)(void* mutex);
+ RR_HIDDEN int (*real_pthread_mutex_timedlock)(void* mutex,
+@@ -775,6 +776,7 @@ static void __attribute__((constructor)) init_process(void) {
+ "or try using `rr record -n` (slow).");
+ }
+
++ real_pthread_mutex_init = dlsym(RTLD_NEXT, "pthread_mutex_init");
+ real_pthread_mutex_lock = dlsym(RTLD_NEXT, "pthread_mutex_lock");
+ real_pthread_mutex_trylock = dlsym(RTLD_NEXT, "pthread_mutex_trylock");
+ real_pthread_mutex_timedlock = dlsym(RTLD_NEXT, "pthread_mutex_timedlock");
+diff --git a/src/preload/syscallbuf.h b/src/preload/syscallbuf.h
+index d810ef7a..6e752fbe 100644
+--- a/src/preload/syscallbuf.h
++++ b/src/preload/syscallbuf.h
+@@ -12,6 +12,7 @@ RR_HIDDEN extern struct preload_globals globals;
+ RR_HIDDEN extern char impose_syscall_delay;
+ RR_HIDDEN extern char impose_spurious_desched;
+
++RR_HIDDEN extern int (*real_pthread_mutex_init)(void* mutex, const void* attr);
+ RR_HIDDEN extern int (*real_pthread_mutex_lock)(void* mutex);
+ RR_HIDDEN extern int (*real_pthread_mutex_trylock)(void* mutex);
+ RR_HIDDEN extern int (*real_pthread_mutex_timedlock)(void* mutex,
+diff --git a/src/test/pthread_pi_mutex.c b/src/test/pthread_pi_mutex.c
+new file mode 100644
+index 00000000..7336004f
+--- /dev/null
++++ b/src/test/pthread_pi_mutex.c
+@@ -0,0 +1,18 @@
++/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */
++
++#include "util.h"
++
++int main(void) {
++ pthread_mutexattr_t attr;
++ pthread_mutex_t mutex;
++
++ test_assert(pthread_mutexattr_init(&attr) == 0);
++ test_assert(pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT) == 0);
++ test_assert(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
++ test_assert(pthread_mutex_init(&mutex, &attr) == 0);
++ test_assert(pthread_mutex_destroy(&mutex) == 0);
++ test_assert(pthread_mutexattr_destroy(&attr) == 0);
++
++ atomic_puts("EXIT-SUCCESS");
++ return 0;
++}
diff --git a/rr-sigstksz.patch b/rr-sigstksz.patch
new file mode 100644
index 0000000..e84d753
--- /dev/null
+++ b/rr-sigstksz.patch
@@ -0,0 +1,34 @@
+commit a744ceff00ffc04c9b3e9cc9d424d434c5a808b7
+Author: Robert O'Callahan <robert@ocallahan.org>
+Date: Tue Jul 13 11:48:29 2021 +1200
+
+ Fix build when SIGSTKSZ is not a constant.
+
+ Resolves #2916
+
+diff --git a/src/test/stack_overflow_altstack.c b/src/test/stack_overflow_altstack.c
+index 12bdf151..61b8776f 100644
+--- a/src/test/stack_overflow_altstack.c
++++ b/src/test/stack_overflow_altstack.c
+@@ -3,7 +3,6 @@
+ #include "util.h"
+
+ static int depth = 0;
+-static char buf[SIGSTKSZ];
+
+ static void SEGV_handler(__attribute__((unused)) int sig,
+ __attribute__((unused)) siginfo_t* si,
+@@ -31,10 +30,11 @@ int main(void) {
+ struct rlimit r = { 500000, 500000 };
+ struct sigaction act;
+ stack_t stack;
++ size_t stack_size = SIGSTKSZ;
+
+ stack.ss_flags = 0;
+- stack.ss_size = sizeof(buf);
+- stack.ss_sp = buf;
++ stack.ss_size = stack_size;
++ stack.ss_sp = mmap(NULL, stack_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ test_assert(0 == sigaltstack(&stack, NULL));
+
+ act.sa_sigaction = SEGV_handler;
diff --git a/rr.spec b/rr.spec
index 03dc19b..1fd829d 100644
--- a/rr.spec
+++ b/rr.spec
@@ -4,7 +4,7 @@
%global commit c2878731db4ed3d16ee999fa74fe2a5fb7edb0e6
%global gittag 5.4.0
%global shortcommit %(c=%{commit}; echo ${c:0:7})
-%global baserelease 3
+%global baserelease 4
ExclusiveArch: %{ix86} x86_64
@@ -26,6 +26,9 @@ License: MIT and CC0 and BSD
URL: http://rr-project.org
Source: https://github.com/mozilla/rr/archive/%{gittag}/%{name}-%{version}.tar.gz
+Patch1: rr-sigstksz.patch
+Patch2: rr-pthread_mutex0.patch
+Patch3: rr-pthread_mutex.patch
%if 0%{?rhel} == 7
BuildRequires: cmake3
@@ -66,6 +69,9 @@ which are used to test the functionality of rr.
%prep
%setup -q -n rr-%{gittag}
+%patch1 -p1 -b .sigstksz
+%patch2 -p1 -b .mutex0
+%patch3 -p1 -b .mutex
%build
%if 0%{?rhel} == 7
@@ -123,6 +129,9 @@ patchelf --set-rpath '%{_libdir}/rr/' %{buildroot}%{_libdir}/rr/testsuite/obj/bi
%license LICENSE
%changelog
+* Thu Jul 29 2021 William Cohen <wcohen@redhat.com> - 5.4.0-4
+- Fix FTBFS (rhbz#1987924)
+
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-10 21:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 21:34 [rpms/rr] epel10.3: Resolves: rhbz1987924 William Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox