public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rr] epel10: Backport upstream fix for MADV_GUARD_INSTALL/REMOVE
Date: Tue, 10 Nov 2026 21:33:43 GMT	[thread overview]
Message-ID: <179434642392.1.17785602968590114863.rpms-rr-bde6d723d13c@fedoraproject.org> (raw)

            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
 

                 reply	other threads:[~2026-11-10 21:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179434642392.1.17785602968590114863.rpms-rr-bde6d723d13c@fedoraproject.org \
    --to=amerey@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox