Skip to main content
QUICK REVIEW

[论文解读] Engineering Record And Replay For Deployability: Extended Technical Report

Robert O'Callahan, Chris Jones|arXiv (Cornell University)|May 16, 2017
Parallel Computing and Optimization TechniquesComputer Science参考文献 28被引用 19
一句话总结

本文提出 rr,一个适用于 x86/x86-64 Linux 的实用、用户空间记录与重放系统,可在无需内核修改、广泛仪器化或虚拟化的情况下,对未经修改的应用程序实现低开销调试。通过结合基于 ptrace 的系统调用记录与利用 seccomp-bpf 和 perf 上下文切换事件实现的新型进程内系统调用拦截技术,rr 在 Firefox 等真实工作负载上实现了低于 2 倍的性能损耗,证明了在标准硬件与软件上实现可部署、高性能记录与重放是可行的。

ABSTRACT

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.

研究动机与目标

  • 解决复杂、未经修改的应用程序在生产环境中缺乏可部署的记录与重放系统的问题。
  • 克服现有方法存在的限制,如需要虚拟机、内核修改、编译器更改或广泛仪器化。
  • 开发一种实用的用户空间系统,可在商品硬件上与标准编译器、运行时环境和操作系统协同工作。
  • 在保持调试与取证分析的确定性与正确性的前提下,将性能开销降至最低。
  • 在 Mozilla 的 Firefox 等真实开发环境中,证明记录与重放的可行性和实用性。

提出的方法

  • 使用 ptrace 在用户空间记录系统调用结果和信号,避免内核修改。
  • 强制每个核心仅单线程执行,以消除数据竞争并确保确定性。
  • 利用硬件性能计数器同步异步事件(如信号和上下文切换)。
  • 通过 seccomp-bpf 实现进程内系统调用拦截,以抑制特定系统调用的 ptrace 捕获。
  • 利用 perf 上下文切换事件检测线程在内核中阻塞的时机,实现精确的重放时间控制。
  • 结合上述技术,消除 ptrace 监控期间的昂贵上下文切换,显著降低开销。

实验结果

研究问题

  • RQ1能否在不修改内核、不进行广泛仪器化或虚拟化的情况下,构建一个实用的用户空间记录与重放系统?
  • RQ2实现低开销、可部署的记录与重放,需要哪些硬件与操作系统特性支持?
  • RQ3进程内系统调用拦截能否消除由 ptrace 上下文切换引起的性能瓶颈?
  • RQ4现有非确定性工作负载(如 Firefox)在最小开销下能多大程度上被忠实记录与重放?
  • RQ5哪些系统设计约束决定了此类系统在现代架构上的可实现性或不可行性?

主要发现

  • rr 在真实世界、低并行度工作负载(如 Firefox 测试套件)上实现了低于 2 倍的性能损耗,证明了其实际性能表现。
  • 进程内系统调用拦截技术显著降低了上下文切换开销,使记录与重放可适用于生产环境。
  • rr 可靠地运行于未经修改的应用程序,包括 Firefox、Chromium、Samba、QEMU、LibreOffice 和 Wine,展现出广泛的兼容性。
  • 该系统依赖于近期才可用的功能,如 seccomp-bpf 和用户空间可访问的硬件性能计数器(如 Intel Westmere),这些在几年前尚不可用。
  • rr 的设计约束揭示,目前 ARM CPU 尚不支持所需的确定性性能计数器行为,限制了其可移植性。
  • 该系统证明,记录与重放可在真实工程环境中大规模部署,且无需特殊硬件或特权访问。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。