paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Copy-on-Pin: The Missing Piece for Correct Copy-on-Write

Copy-on-Pin:正确写时复制缺失的一环
ASPLOS Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 22023匹配度 1/10 · 该论文研究操作系统内核中页固定与写时复制的内存管理缺陷,属于OS/运行时系统方向;与用户关注的静态分析、LLM/Agentic程序分析、浮点程序分析及贝叶斯程序分析均无直接交集。引用 4 inbox
David Hildenbrand, Martin Schulz, Nadav Amit
crossref: 2026-09-12

AI 速览

一句话:提出 Copy-on-Pin 机制,修正页固定与写时复制的冲突,并落地于 Linux 5.19。

操作系统用写时复制(COW)节省内存并提升性能,但近二十年出现多起与页固定(pinning)相关的 COW bug,造成安全、内存损坏和性能退化。现有修复多不完整,根因未被充分理解。本文首先调研已报告的 pinning 相关 COW bug,并在 Linux、FreeBSD 和 NetBSD 中发现新 bug,指出 COW 逻辑未正确处理页固定,导致陈旧 I/O 等错误行为。随后推导共享页何时必须复制、固定页在何条件下可共享,提出 Copy-on-Pin(COP)方案,使固定页与共享页互斥。针对朴素实现影响性能且增加复杂度的问题,作者设计 relaxed-COP,无需精确跟踪页共享,保持正确性且不增复杂度;虽在少数角落情形可能多余复制,但性能略有提升。该方案已集成到 Linux 5.19。

问题
操作系统的写时复制(COW)与页固定(pinning)交互不正确,导致安全、内存损坏和性能问题,且其根因未被充分理解,造成修复不完整。
方法
调研并挖掘 Linux、FreeBSD、NetBSD 中 pinning 相关的 COW bug,推导共享页必须复制及固定页可共享的正确条件,提出 Copy-on-Pin(COP)及 relaxed-COP 方案。
评估
在 Linux、FreeBSD 和 NetBSD 上分析此前及新发现的 bug,并将 relaxed-COP 集成到 Linux 5.19,报告正确性与性能影响。
原文摘要(Abstract)

Operating systems utilize Copy-on-Write (COW) to conserve memory and improve performance. During the last two decades, a series of COW-related bugs - which compromised security, corrupted memory and degraded performance - was found. The majority of these bugs are related to page "pinning", which operating systems employ to access process memory efficiently and to perform direct I/O. Unfortunately, the true cause of these bugs is not well understood, resulting in incomplete bug fixes. We show this by: (1) surveying previously reported pinning-related COW bugs; (2) uncovering new such bugs in Linux, FreeBSD, and NetBSD; and (3) showing that they occur because the COW logic does not consider page pinnings correctly, resulting in incorrect behavior (e.g., I/O of stale data). We then address the underlying problem by deriving when/how shared pages must be copied and under which conditions pinned pages can be shared to maintain correctness. Based on this assessment, we introduce the "Copy-on-Pin (COP)" scheme, an extension of the COW mechanism that handles pinned pages correctly by ensuring pinned pages and shared pages are mutually exclusive. However, we find that a naive implementation of this scheme hampers performance and increases complexity if pages are copied only when strictly necessary. To compensate, we introduce a relaxed-COP design, which does not require precise tracking of page sharing, maintains correctness without increasing complexity, and (while potentially needlessly copying pages in some corner cases) marginally improves performance. Our relaxed-COP solution has been integrated into Linux 5.19.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot9997,
  title = {Copy-on-Pin: The Missing Piece for Correct Copy-on-Write},
  author = {David Hildenbrand and Martin Schulz and Nadav Amit},
  booktitle = {ASPLOS},
  year = {2023},
  doi = {10.1145/3575693.3575716}
}