public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rr] epel10: Backport upstream fix for MADV_GUARD_INSTALL/REMOVE
@ 2026-11-10 21:33 Aaron Merey
  0 siblings, 0 replies; only message in thread
From: Aaron Merey @ 2026-11-10 21:33 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rr
            Branch : epel10
            Commit : bde6d723d13c882a67b80ee9ffebe3b9ebf6c897
            Author : Aaron Merey <amerey@redhat.com>
            Date   : 2026-04-28T13:13:53-04:00
            Stats  : +85/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rr/c/bde6d723d13c882a67b80ee9ffebe3b9ebf6c897?branch=epel10

            Log:
            Backport upstream fix for MADV_GUARD_INSTALL/REMOVE

Linux 6.13 added MADV_GUARD_INSTALL (102) and MADV_GUARD_REMOVE (103),
and modern glibc uses them to install pthread stack guards. rr 5.9.0
doesn't recognize these advice values and aborts on a fatal assertion
when recording any threaded program on kernels >= 6.13.

Backport upstream commit 34ff3a70, which emulates both as returning
-EINVAL (matching pre-6.13 kernel behavior). Verified that the
reproducer records and replays cleanly with the patched build.

https://bugzilla.redhat.com/show_bug.cgi?id=2459980

---
diff --git a/rr-5.9.0-emulate-madv-guard.patch b/rr-5.9.0-emulate-madv-guard.patch
new file mode 100644
index 0000000..75f19e4
--- /dev/null
+++ b/rr-5.9.0-emulate-madv-guard.patch
@@ -0,0 +1,78 @@
+From 34ff3a700a0b972ab5b16727fa3015dc4ed0a4c4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
+Date: Fri, 1 Aug 2025 14:22:21 +0200
+Subject: [PATCH] Emulate -EINVAL for MADV_GUARD_{INSTALL,REMOVE}.
+
+Fixes #3997
+---
+ src/kernel_supplement.h | 6 ++++++
+ src/record_syscall.cc   | 4 ++++
+ src/test/madvise_misc.c | 2 ++
+ src/test/util.h         | 6 ++++++
+ 4 files changed, 18 insertions(+)
+
+diff --git a/src/kernel_supplement.h b/src/kernel_supplement.h
+index 490b433a..9fb2b069 100644
+--- a/src/kernel_supplement.h
++++ b/src/kernel_supplement.h
+@@ -281,6 +281,12 @@ struct rr_input_mask {
+ #ifndef MADV_COLLAPSE
+ #define MADV_COLLAPSE 25
+ #endif
++#ifndef MADV_GUARD_INSTALL
++#define MADV_GUARD_INSTALL 102
++#endif
++#ifndef MADV_GUARD_REMOVE
++#define MADV_GUARD_REMOVE 103
++#endif
+ 
+ #ifndef BUS_MCEERR_AR
+ #define BUS_MCEERR_AR 4
+diff --git a/src/record_syscall.cc b/src/record_syscall.cc
+index bee9f550..363f94f3 100644
+--- a/src/record_syscall.cc
++++ b/src/record_syscall.cc
+@@ -5245,6 +5245,10 @@ static Switchable rec_prepare_syscall_arch(RecordTask* t,
+           t->set_regs(r);
+           break;
+         }
++        case MADV_GUARD_INSTALL:
++        case MADV_GUARD_REMOVE:
++          syscall_state.emulate_result(-EINVAL);
++          break;
+         default:
+           syscall_state.expect_errno = EINVAL;
+           break;
+diff --git a/src/test/madvise_misc.c b/src/test/madvise_misc.c
+index bda2ea06..a6b0fe57 100644
+--- a/src/test/madvise_misc.c
++++ b/src/test/madvise_misc.c
+@@ -29,6 +29,8 @@ int main(void) {
+   DO_MADVISE(MADV_POPULATE_READ);
+   DO_MADVISE(MADV_POPULATE_WRITE);
+   DO_MADVISE(MADV_COLLAPSE);
++  DO_MADVISE(MADV_GUARD_INSTALL);
++  DO_MADVISE(MADV_GUARD_REMOVE);
+ 
+   atomic_puts("EXIT-SUCCESS");
+ 
+diff --git a/src/test/util.h b/src/test/util.h
+index e4c4aa52..f7a751b7 100644
+--- a/src/test/util.h
++++ b/src/test/util.h
+@@ -497,6 +497,12 @@ struct open_how {
+ #ifndef MADV_COLLAPSE
+ #define MADV_COLLAPSE 25
+ #endif
++#ifndef MADV_GUARD_INSTALL
++#define MADV_GUARD_INSTALL 102
++#endif
++#ifndef MADV_GUARD_REMOVE
++#define MADV_GUARD_REMOVE 103
++#endif
+ 
+ #ifndef F_OFD_GETLK
+ #define F_OFD_GETLK 36
+-- 
+2.53.0
+

diff --git a/rr.spec b/rr.spec
index c67ba6b..353538c 100644
--- a/rr.spec
+++ b/rr.spec
@@ -4,7 +4,7 @@
 %global commit da33770d22b404d7333e46e26495eaca0c5a6d8a
 %global gittag 5.9.0
 %global shortcommit %(c=%{commit}; echo ${c:0:7})
-%global baserelease 7
+%global baserelease 8
 
 ExclusiveArch:  %{ix86} x86_64 aarch64
 
@@ -34,6 +34,8 @@ Patch1: remove-termio.patch
 Patch2: update-cmake-ver.patch
 # https://github.com/rr-debugger/rr/issues/4037
 Patch3: rr-5.9.0-use-openat2-header.patch
+# https://github.com/rr-debugger/rr/issues/3997
+Patch4: rr-5.9.0-emulate-madv-guard.patch
 
 %if  0%{?rhel} == 7
 BuildRequires: cmake3
@@ -136,6 +138,10 @@ patchelf --set-rpath '%{_libdir}/rr/' %{buildroot}%{_libdir}/rr/testsuite/obj/bi
 %license LICENSE
 
 %changelog
+* Tue Apr 28 2026 Aaron Merey <amerey@redhat.com> - 5.9.0-8
+- Backport upstream fix for MADV_GUARD_INSTALL/REMOVE (kernel >= 6.13)
+  to unbreak recording of multi-threaded programs (upstream commit 34ff3a70).
+
 * Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.0-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
 

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

only message in thread, other threads:[~2026-11-10 21:33 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:33 [rpms/rr] epel10: Backport upstream fix for MADV_GUARD_INSTALL/REMOVE Aaron Merey

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