Package: rr
Version: 5.3.0-3
Severity: normal

Dear Maintainer,
thank you for building i386 again.

Unfortunately I found recording not working in a small test [1].

A git bisect led to a helper function introduced by upstream in [2].
This helper uses a function parameter of type off_t.
But the pwrite64 from glibc uses off64_t.
Therefore offset values with the highest bit set get incorrectly
converted to the 64 bit type, e.g.: 0xbffff622 -> 0xffffffffbffff622
Therefore the write fails and rr stops.

Attached patch makes rr work on i386 and passing most tests
in my test VM, except [3]. Have not tested for side effects at amd64.

I am going to try to forward this to upstream too,
will update this bug then.

Kind regards,
Bernhard




[1]
$ /usr/bin/rr record /bin/ls
rr: Saving execution to trace directory `/home/benutzer/.local/share/rr/ls-0'.
[FATAL /build/rr-wu2MDM/rr-5.3.0/src/AddressSpace.cc:320:map_rr_page()] 
 (task 6291 (rec:6291) at time 14)
 -> Assertion `child_fd == -EACCES' failed to hold. Unexpected error mapping 
rr_page
Tail of trace dump:
[FATAL /build/rr-wu2MDM/rr-5.3.0/src/DumpCommand.cc:180:dump_events_matching()] 
TraceTaskEvent times non-increasing
=== Start rr backtrace:
/usr/bin/rr(_ZN2rr13dump_rr_stackEv+0x43)[0x6489e3]
/usr/bin/rr(_ZN2rr15notifying_abortEv+0x5a)[0x648a8a]
/usr/bin/rr(_ZN2rr12FatalOstreamD1Ev+0x53)[0x569723]
/usr/bin/rr(+0x6f175)[0x521175]
/usr/bin/rr(_ZN2rr4dumpERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_9DumpFlagsERKSt6vectorIS5_SaIS5_EEP8_IO_FILE+0x8d)[0x521c5d]
/usr/bin/rr(+0xb7985)[0x569985]
/usr/bin/rr(_ZN2rr21EmergencyDebugOstreamD2Ev+0x81)[0x569c11]
/usr/bin/rr(_ZN2rr12AddressSpace11map_rr_pageERNS_18AutoRemoteSyscallsE+0x8b8)[0x50d188]
/usr/bin/rr(_ZN2rr12AddressSpace17post_exec_syscallEPNS_4TaskE+0x88)[0x50f7b8]
/usr/bin/rr(_ZN2rr4Task17post_exec_syscallEv+0x46)[0x625b26]
/usr/bin/rr(+0xf989f)[0x5ab89f]
/usr/bin/rr(+0x114183)[0x5c6183]
/usr/bin/rr(_ZN2rr19rec_process_syscallEPNS_10RecordTaskE+0xa3)[0x5cd1c3]
/usr/bin/rr(_ZN2rr13RecordSession21syscall_state_changedEPNS_10RecordTaskEPNS0_9StepStateE+0xe5d)[0x59143d]
/usr/bin/rr(_ZN2rr13RecordSession11record_stepEv+0x45b)[0x5978bb]
/usr/bin/rr(_ZN2rr13RecordCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0xf68)[0x58c6d8]
/usr/bin/rr(main+0x298)[0x5054a8]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0xb791bef1]
/usr/bin/rr(_start+0x31)[0x505611]
=== End rr backtrace
Abgebrochen



[2] 
https://github.com/mozilla/rr/commit/531062cca8670f13ae99de3322df650e43269784



[3]
98% tests passed, 20 tests failed out of 1157
Total Test time (real) = 3370.80 sec
The following tests FAILED:
        440 - quotactl (Failed)
        441 - quotactl-no-syscallbuf (Failed)
        512 - sem (Failed)
        513 - sem-no-syscallbuf (Failed)
        534 - shm (Failed)
        535 - shm-no-syscallbuf (Failed)
        536 - shm_unmap (Failed)
        537 - shm_unmap-no-syscallbuf (Failed)
        708 - std_random (Failed)
        709 - std_random-no-syscallbuf (Failed)
        962 - vsyscall_reverse_next (Failed)
        963 - vsyscall_reverse_next-no-syscallbuf (Failed)
        1110 - shm_checkpoint (Failed)
        1111 - shm_checkpoint-no-syscallbuf (Failed)
        1116 - signal_stop (Failed)
        1117 - signal_stop-no-syscallbuf (Failed)
        1118 - signal_checkpoint (Failed)
        1119 - signal_checkpoint-no-syscallbuf (Failed)
        1132 - step_signal (Failed)
        1133 - step_signal-no-syscallbuf (Failed)
Errors while running CTest




-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 5.6.0-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages rr depends on:
ii  libc6           2.30-8
ii  libcapnp-0.7.0  0.7.0-6
ii  libgcc-s1       10.1.0-3
ii  libstdc++6      10.1.0-3
ii  python3         3.8.2-3
ii  sse2-support    5

rr recommends no packages.

rr suggests no packages.

-- no debconf information
>From bd04f8a1a3ac113a25f38f8e4da66945a98fac32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernha...@mailbox.org>
Date: Sun, 31 May 2020 13:25:50 +0200
Subject: [PATCH 1/1] i386: Use off64_t instead of off_t.

A offset value of 0xbffff622 in pwrite_all_fallible gets converted
to a value of 0xffffffffbffff622 in __libc_pwrite64.
This gets visible just at 32bit.

Got introduced by commit 531062cca8670f13ae99de3322df650e43269784.

[FATAL /build/rr-wu2MDM/rr-5.3.0/src/AddressSpace.cc:320:map_rr_page()]
 (task 6291 (rec:6291) at time 14)
 -> Assertion `child_fd == -EACCES' failed to hold. Unexpected error mapping rr_page
---
 src/util.cc | 2 +-
 src/util.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: rr-5.3.0/src/util.cc
===================================================================
--- rr-5.3.0.orig/src/util.cc
+++ rr-5.3.0/src/util.cc
@@ -1636,7 +1636,7 @@ void write_all(int fd, const void* buf,
   }
 }
 
-ssize_t pwrite_all_fallible(int fd, const void* buf, size_t size, off_t offset) {
+ssize_t pwrite_all_fallible(int fd, const void* buf, size_t size, off64_t offset) {
   ssize_t written = 0;
   while (size > 0) {
     ssize_t ret = ::pwrite64(fd, buf, size, offset);
Index: rr-5.3.0/src/util.h
===================================================================
--- rr-5.3.0.orig/src/util.h
+++ rr-5.3.0/src/util.h
@@ -423,7 +423,7 @@ uint32_t crc32(uint32_t crc, unsigned ch
 void write_all(int fd, const void* buf, size_t size);
 
 /* Like pwrite64(2) but we try to write all bytes by looping on short writes. */
-ssize_t pwrite_all_fallible(int fd, const void* buf, size_t size, off_t offset);
+ssize_t pwrite_all_fallible(int fd, const void* buf, size_t size, off64_t offset);
 
 /* Returns true if |path| is an accessible directory. Returns false if there
  * was an error.

Reply via email to