Skip to main content
QUICK REVIEW

[Paper Review] Lightweight User-Space Record And Replay

Rumsevicius, Ugnius, Venkateshwaran, Siddhanth|arXiv (Cornell University)|Oct 7, 2016
Parallel Computing and Optimization TechniquesComputer Science28 references7 citations
TL;DR

This paper presents RR, a lightweight, user-space record-and-replay system for Linux that enables low-overhead execution recording and deterministic replay of unmodified user-space applications on stock x86/x86-64 hardware and kernels. By combining ptrace for system call recording, hardware performance counters for precise event timing, and a novel system-call buffering optimization using seccomp-bpf and perf context-switch events, RR achieves sub-2x slowdown on real-world workloads without kernel modifications or pervasive code instrumentation.

ABSTRACT

Browsers are the main way in which most users experience the internet, which makes them a prime target for malicious entities. The best defense for the common user is to keep their browser always up-to-date, installing updates as soon as they are available. Unfortunately, updating a browser is disruptive as it results in loss of user state. Even though modern browsers reopen all pages (tabs) after an update to minimize inconvenience, this approach still loses all local user state in each page (e.g., contents of unsubmitted forms, including associated JavaScript validation state) and assumes that pages can be refreshed and result in the same contents. We believe this is an important barrier that keeps users from updating their browsers as frequently as possible. In this paper, we present the design, implementation, and evaluation of Sinatra, which supports instantaneous browser updates that do not result in any data loss through a novel Multi-Version eXecution (MVX) approach for JavaScript programs, combined with a sophisticated proxy. Sinatra works in pure JavaScript, does not require any browser support, thus works on closed-source browsers, and requires trivial changes to each target page, that can be automated. First, Sinatra captures all the non-determinism available to a JavaScript program (e.g., event handlers executed, expired timers, invocations of Math.random). Our evaluation shows that Sinatra requires 6MB to store such events, and the memory grows at a modest rate of 253KB/s as the user keeps interacting with each page. When an update becomes available, Sinatra transfer the state by re-executing the same set of non-deterministic events on the new browser. During this time, which can be as long as 1.5 seconds, Sinatra uses MVX to allow the user to keep interacting with the old browser. Finally, Sinatra changes the roles in less than 10ms, and the user starts interacting with the new browser, effectively performing a browser update with zero downtime and no loss of state.

Motivation & Objective

  • To enable practical, low-overhead record-and-replay of unmodified Linux user-space applications without kernel modifications or pervasive code instrumentation.
  • To identify and leverage existing hardware and OS features—specifically ptrace, hardware performance counters, seccomp-bpf, and perf context-switch events—to build a fully user-space solution.
  • To reduce the performance overhead of record-and-replay, especially due to ptrace context switches, through a novel system-call buffering optimization.
  • To demonstrate that deterministic replay is feasible on commodity x86/x86-64 systems with stock kernels, despite non-deterministic behaviors like data races and asynchronous signals.
  • To provide a production-ready, open-source framework that supports reverse-execution debugging and forensic analysis of complex applications.

Proposed method

  • Uses ptrace to monitor and record system call entry and exit, capturing register and memory state changes.
  • Enforces single-threaded execution to eliminate data race nondeterminism, with replay preserving exact user-space state and memory layout.
  • Leverages hardware performance counters to detect kernel blocking and deliver asynchronous events (e.g., signals, context switches) at precise replay times.
  • Implements a system-call buffering optimization that suppresses ptrace traps for selected system calls using seccomp-bpf, eliminating costly context switches.
  • Uses perf context-switch events to detect when a thread blocks in the kernel, enabling efficient scheduling of other threads during replay.
  • Replays only user-space state and execution, reconstructing kernel-visible effects (e.g., file descriptors, signals) without actual system calls.

Experimental results

Research questions

  • RQ1Can a practical, low-overhead record-and-replay system be built entirely in user space without kernel modifications or pervasive code instrumentation?
  • RQ2What hardware and operating system features are necessary to support such a system on commodity x86/x86-64 platforms?
  • RQ3Can system-call buffering using seccomp-bpf and perf context-switch events eliminate the performance bottleneck caused by ptrace context switches?
  • RQ4How does the single-threaded execution model affect the detection of concurrency bugs, and can it be extended to improve coverage?
  • RQ5What are the performance characteristics of such a system on real-world, complex applications like Firefox, QEMU, and Samba?

Key findings

  • RR achieves recording and replay overhead of less than a factor of two on important real-world workloads, demonstrating practical performance.
  • The system-call buffering optimization using seccomp-bpf and perf context-switch events eliminates the majority of ptrace-induced context switches, drastically reducing overhead.
  • RR successfully records and replays complex, unmodified applications such as Firefox, Samba, QEMU, LibreOffice, and Wine with high fidelity.
  • The approach is feasible only on modern x86/x86-64 systems with specific hardware and kernel features—particularly deterministic hardware performance counters accessible from user space.
  • The system works by repurposing existing features (ptrace, perf, seccomp-bpf) for record-and-replay, demonstrating that such systems can be built without new hardware or kernel changes.
  • RR is deployed in production environments as the foundation of a reverse-execution debugger, proving real-world utility and stability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.