From 95bdf905dca14750ea66677805d149aec11a9ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 14 Sep 2026 22:22:23 +0200 Subject: [PATCH 1/5] Allow the rlimit test to succeed with a 32-bit kernel. Related issue: #4095 --- src/test/rlimit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/rlimit.c b/src/test/rlimit.c index 8d0a671092b..5555a13038b 100644 --- a/src/test/rlimit.c +++ b/src/test/rlimit.c @@ -2,6 +2,19 @@ #include "util.h" +int kernel_is_32bit_x86(void) +{ +#if defined(__i386__) + struct utsname buf; + if (uname(&buf) != 0) + return 0; + + if (strcmp(buf.machine, "i686") == 0) // running at a 32bit kernel + return 1; +#endif + return 0; +} + int main(void) { struct rlimit* r; struct rlimit* r2; @@ -14,6 +27,11 @@ int main(void) { test_assert(r->rlim_max > 0); VERIFY_GUARD(r); + /* When running a 32-bit kernel and using the 64-bit rlimit struct, + * a value above 0xfffffffe fails. */ + if (kernel_is_32bit_x86()) + r->rlim_cur &= 0xffffffff; + r->rlim_cur /= 2; test_assert(0 == setrlimit(RLIMIT_FSIZE, r)); VERIFY_GUARD(r); From c023e5f27a3e612f59065e15503f4f7ec34e668d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 14 Sep 2026 22:36:30 +0200 Subject: [PATCH 2/5] Skip fd_leak when running with a 32-bit rr but with a 64-bit shell. Related issue: #4095 --- src/test/fd_leak.run | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/fd_leak.run b/src/test/fd_leak.run index a0a18db08d5..a54650a5b36 100644 --- a/src/test/fd_leak.run +++ b/src/test/fd_leak.run @@ -1,4 +1,7 @@ source `dirname $0`/util.sh + +skip_if_rr_32_bit_with_shell_64_bit + num_baseline=$(ls -la /proc/self/fd | wc -l) just_record $(which rr) "record --nested=detach ls -la /proc/self/fd" replay From 49015ebfc93b89b350c254aa16e794a8ca7cd201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 14 Sep 2026 22:36:49 +0200 Subject: [PATCH 3/5] Skip unmap_vdso when running with a 32-bit rr but with a 64-bit shell. Related issue: #4095 --- src/test/unmap_vdso.run | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/unmap_vdso.run b/src/test/unmap_vdso.run index 5946364557d..66b7a4ef1f2 100644 --- a/src/test/unmap_vdso.run +++ b/src/test/unmap_vdso.run @@ -1,4 +1,7 @@ source `dirname $0`/util.sh + +skip_if_rr_32_bit_with_shell_64_bit + RECORD_ARGS="--unmap-vdso" just_record cat /proc/self/maps if grep "vdso" record.out; then From bc55f3d5c6d20f134c451d1913e2ac78d8c6e425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Tue, 15 Sep 2026 00:31:47 +0200 Subject: [PATCH 4/5] Set bp_len in init_hw_breakpoint_attr depending on the kernel bitness. Followup of dfc3b4bcea. Related issue: #4095 --- src/PerfCounters.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/PerfCounters.cc b/src/PerfCounters.cc index d567809389b..8ef181473e3 100644 --- a/src/PerfCounters.cc +++ b/src/PerfCounters.cc @@ -21,6 +21,7 @@ #include #endif #include +#include #include #include @@ -1243,6 +1244,19 @@ static struct perf_event_attr init_hw_breakpoint_attr() { attr.wakeup_events = 1; attr.precise_ip = 3; attr.disabled = 1; + +#if defined(__i386__) + struct utsname buf; + if (uname(&buf) != 0) { + FATAL() << "Failed to call uname"; + } + if (strcmp(buf.machine, "x86_64") == 0) { + /* A 32-bit rr running at a 64-bit kernel + * needs to set bp_len as needed by the kernel. */ + attr.bp_len = HW_BREAKPOINT_LEN_8; + } +#endif + return attr; } From b7e64cef1af95f0127e1141aa6486bbb87a944ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Tue, 15 Sep 2026 00:32:47 +0200 Subject: [PATCH 5/5] Fix message in check_outside_mappings if call to uname failed. --- src/record_syscall.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/record_syscall.cc b/src/record_syscall.cc index ae6b86fe914..78e44ef152e 100644 --- a/src/record_syscall.cc +++ b/src/record_syscall.cc @@ -6375,7 +6375,7 @@ static void check_outside_mappings(const KernelMapping& tracee_km, const RecordS #if defined(__i386__) struct utsname buf; if (uname(&buf) != 0) { - FATAL() << "Failed to read /proc"; + FATAL() << "Failed to call uname"; } if (sizeof(void*) == 4 && strcmp(buf.machine, "x86_64") == 0) { /* Running 32-bit rr at a 64-bit kernel is not going to work because