paperbot · PL 论文追踪

全部论文 待读 收藏

P2 MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code

MSWasm:可靠地强制执行不安全代码的内存安全执行
POPL 7(POPL)2023匹配度 2/10 · 该论文属于WebAssembly内存安全、形式语义与编译器实现,虽兼具形式化和工程实现,但与用户当前核心方向(LLM/Agent与静态分析/形式化验证交叉、浮点程序分析、贝叶斯程序分析)没有直接关联,也未涉及AI/LLM工具或ML系统分析。引用 22 inbox
Alexandra E. Michael, Anitha Gollamudi, Jay Bosamiya, Evan Johnson, Aidan Denlinger, Craig Disselkoen, Conrad Watt, Bryan Parno, Marco Patrignani, Marco Vassena, Deian Stefan
crossref: 2026-09-10

AI 速览

一句话:为 Wasm 引入语言级内存安全抽象,形式化证明良类型程序内存安全,并实现支持多种强制机制的编译器。

编译到 WebAssembly 的程序多由 C/C++ 等不安全语言编写,缓冲区溢出和 use-after-free 等漏洞在 Wasm 中同样可被利用。MSWasm 为 Wasm 引入语言级内存安全抽象。本文给出 MSWasm 的精确形式语义,提出基于“着色内存位置与指针”的语言无关内存安全性质,证明良类型程序具有鲁棒内存安全;并形式化 C-to-MSWasm 编译器,证明其总产生内存安全程序且保持安全程序语义。基于这些结果,作者实现两个 MSWasm 到原生代码的编译器和一个扩展 Clang 的 C-to-MSWasm 编译器,支持多种强制机制。在 PolyBenchC 上,软件强制执行内存安全开销为 22%(仅空间安全)到 198%(完整内存安全),用硬件内存能力实现空间安全和指针完整性时为 51.7%。

问题
编译到 Wasm 的 C/C++ 等不安全语言代码仍保留缓冲区溢出、use-after-free 等内存不安全问题,攻击者可像在原生平台上一样利用它们。
方法
给出 MSWasm 的精确形式语义和基于着色内存位置与指针的语言无关内存安全性质,证明良类型程序鲁棒内存安全并形式化验证 C-to-MSWasm 编译器;据此实现两个 MSWasm 到原生代码的编译器和一个扩展 Clang 的 C-to-MSWasm 编译器,支持不同强制机制与安全-性能权衡。
评估
在 PolyBenchC 基准上测量不同强制机制的开销:纯软件方案从 22%(仅空间安全)到 198%(完整内存安全),使用硬件内存能力实现空间安全与指针完整性时为 51.7%,并展示强制机制易于替换。
原文摘要(Abstract)

Most programs compiled to WebAssembly (Wasm) today are written in unsafe languages like C and C++. Unfortunately, memory-unsafe C code remains unsafe when compiled to Wasm—and attackers can exploit buffer overflows and use-after-frees in Wasm almost as easily as they can on native platforms. Memory- Safe WebAssembly (MSWasm) proposes to extend Wasm with language-level memory-safety abstractions to precisely address this problem. In this paper, we build on the original MSWasm position paper to realize this vision. We give a precise and formal semantics of MSWasm, and prove that well-typed MSWasm programs are, by construction, robustly memory safe. To this end, we develop a novel, language-independent memory-safety property based on colored memory locations and pointers. This property also lets us reason about the security guarantees of a formal C-to-MSWasm compiler—and prove that it always produces memory-safe programs (and preserves the semantics of safe programs). We use these formal results to then guide several implementations: Two compilers of MSWasm to native code, and a C-to-MSWasm compiler (that extends Clang). Our MSWasm compilers support different enforcement mechanisms, allowing developers to make security-performance trade-offs according to their needs. Our evaluation shows that on the PolyBenchC suite, the overhead of enforcing memory safety in software ranges from 22% (enforcing spatial safety alone) to 198% (enforcing full memory safety), and 51.7% when using hardware memory capabilities for spatial safety and pointer integrity. More importantly, MSWasm’s design makes it easy to swap between enforcement mechanisms; as fast (especially hardware-based) enforcement techniques become available, MSWasm will be able to take advantage of these advances almost for free.

链接与引用

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

BibTeX
@article{paperbot2107,
  title = {MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code},
  author = {Alexandra E. Michael and Anitha Gollamudi and Jay Bosamiya and Evan Johnson and Aidan Denlinger and Craig Disselkoen and Conrad Watt and Bryan Parno and Marco Patrignani and Marco Vassena and Deian Stefan},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {POPL},
  year = {2023},
  doi = {10.1145/3571208}
}