[Paper Review] Engineering Record And Replay For Deployability: Extended Technical Report
This paper presents rr, a practical, user-space record-and-replay system for x86/x86-64 Linux that enables low-overhead debugging of unmodified applications without kernel modifications, pervasive instrumentation, or virtualization. By combining ptrace-based system call recording with novel in-process system-call interception using seccomp-bpf and perf context-switch events, rr achieves sub-2x slowdown on real-world workloads like Firefox, demonstrating that deployable, high-performance record-and-replay is feasible on stock hardware and software.
The ability to record and replay program executions with low overhead enables many applications, such as reverse-execution debugging, debugging of hard-to-reproduce test failures, and "black box" forensic analysis of failures in deployed systems. Existing record-and-replay approaches limit deployability by recording an entire virtual machine (heavyweight), modifying the OS kernel (adding deployment and maintenance costs), requiring pervasive code instrumentation (imposing significant performance and complexity overhead), or modifying compilers and runtime systems (limiting generality). We investigated whether it is possible to build a practical record-and-replay system avoiding all these issues. The answer turns out to be yes - if the CPU and operating system meet certain non-obvious constraints. Fortunately modern Intel CPUs, Linux kernels and user-space frameworks do meet these constraints, although this has only become true recently. With some novel optimizations, our system 'rr' records and replays real-world low-parallelism workloads with low overhead, with an entirely user-space implementation, using stock hardware, compilers, runtimes and operating systems. "rr" forms the basis of an open-source reverse-execution debugger seeing significant use in practice. We present the design and implementation of 'rr', describe its performance on a variety of workloads, and identify constraints on hardware and operating system design required to support our approach.
Motivation & Objective
- Address the lack of deployable record-and-replay systems for production debugging of complex, unmodified applications.
- Overcome limitations of existing approaches that require VMs, kernel modifications, compiler changes, or pervasive instrumentation.
- Develop a practical, user-space system that works with stock compilers, runtimes, and operating systems on commodity hardware.
- Minimize performance overhead while preserving determinism and correctness for debugging and forensic analysis.
- Demonstrate feasibility and practicality of record-and-replay in real-world development environments like Mozilla’s Firefox.
Proposed method
- Use ptrace to record system call results and signals in user space, avoiding kernel modifications.
- Enforce single-threaded execution per core to eliminate data races and ensure determinism.
- Leverage hardware performance counters to synchronize asynchronous events like signals and context switches.
- Implement in-process system-call interception using seccomp-bpf to suppress ptrace traps for specific system calls.
- Use perf context-switch events to detect when threads block in the kernel, enabling precise replay timing.
- Combine these techniques to eliminate costly context switches during ptrace monitoring, drastically reducing overhead.
Experimental results
Research questions
- RQ1Can a practical, user-space record-and-replay system be built without kernel modifications, pervasive instrumentation, or virtualization?
- RQ2What hardware and OS features are necessary to enable low-overhead, deployable record-and-replay on commodity x86-64 systems?
- RQ3Can in-process system-call interception eliminate the performance bottleneck caused by ptrace context switches?
- RQ4To what extent can existing, non-deterministic workloads (e.g., Firefox) be faithfully recorded and replayed with minimal overhead?
- RQ5What are the system design constraints that enable or prevent such a system on modern architectures?
Key findings
- rr achieves sub-2x slowdown on real-world, low-parallelism workloads such as the Firefox test suite, demonstrating practical performance.
- The in-process system-call interception technique reduces context-switch overhead significantly, making recording and replay viable for production use.
- rr works reliably on unmodified applications including Firefox, Chromium, Samba, QEMU, LibreOffice, and Wine, showing broad compatibility.
- The system relies on recently available features like seccomp-bpf and user-space-accessible hardware performance counters (e.g., Intel Westmere), which were not available a few years ago.
- rr’s design constraints reveal that ARM CPUs currently do not support the required deterministic performance counter behavior, limiting portability.
- The system demonstrates that record-and-replay can be deployed at scale in real engineering environments without requiring special hardware or privileged access.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.