paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Model Checking C/C++ with Mixed-Size Accesses

混合大小访问的 C/C++ 模型检测
POPL 9(POPL)2025匹配度 3/10 · 该论文属于传统形式化验证/模型检查(DPOR、GenMC、并发内存模型),与用户核心关注的 LLM 与静态分析/程序分析交叉、浮点程序分析、贝叶斯程序分析均无直接关联;仅在广义的程序验证方向上与 PL 研究有较弱交集。引用 2 inbox
Iason Marmanis, Michalis Kokologiannakis, Viktor Vafeiadis
crossref: 2026-09-10

AI 速览

一句话:提出 Mixer——面向混合大小访问程序的最优 DPOR 算法,并在 GenMC 中实现,首次自动验证此类 C/C++ 并发代码。

采用动态偏序归约(DPOR)的先进模型检测器已能在 SC、TSO、RA 以及修复后的 C11 内存模型(RC11)等多种内存模型下,以最优且节省内存的方式验证并发程序。然而,当程序存在混合大小访问(MSA)——即原子指令访问同一字内不同(集合的)字节——时,这些 DPOR 技术无法保持最优性。这类模式在含 C/C++ union 类型的真实代码中自然出现,甚至被用于并发场景。为此,本文提出 Mixer,一种面向 MSA 程序的最优 DPOR 算法,它允许(多字节)读被多个写共同重访。作者将 Mixer 实现于 GenMC 模型检测器,首次实现了对含混合大小访问的 C/C++ 代码的自动验证。该结果还可推广到更一般的事务程序情形,前提是事务的读访问集合能在事务开始时被动态过近似。

问题
现有基于 DPOR 的模型检测器无法以最优方式验证存在混合大小访问(同一字内不同字节被原子指令访问)的并发程序,而这类模式在 C/C++ union 代码中很常见。
方法
提出 Mixer 这一面向 MSA 程序的最优 DPOR 算法,允许多字节读由多个写一并重访,并将其实现于 GenMC;该算法还可推广到读集合能被动态过近似的事务程序。
评估
在 GenMC 模型检测器中实现 Mixer,从而首次支持对含混合大小访问的 C/C++ 代码进行自动验证,并说明其可扩展到事务程序场景。
原文摘要(Abstract)

State-of-the-art model checkers employing dynamic partial order reduction (DPOR) can verify concurrent programs under a wide range of memory models such as sequential consistency (SC), total store order (TSO), release-acquire (RA), and the repaired C11 memory model (RC11) in an optimal and memory-efficient fashion. Unfortunately, these DPOR techniques cannot be applied in an optimal fashion to programs with mixed-sized accesses (MSA), where atomic instructions access different (sets of) bytes belonging to the same word. Such patterns naturally arise in real life code with C/C++ union types, and are even used in a concurrent setting. In this paper, we introduce Mixer , an optimal DPOR algorithm for MSA programs that allows (multi-byte) reads to be revisited by multiple writes together. We have implemented Mixer in the GenMC model checker, enabling (for the first time) the automatic verification of C/C++ code with mixed-size accesses. Our results also extend to the more general case of transactional programs provided that the set of read accesses performed by a transaction can be dynamically overapproximated at the beginning of the transaction.

链接与引用

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

BibTeX
@article{MarmanisKV25,
  title = {Model Checking C/C++ with Mixed-Size Accesses},
  author = {Iason Marmanis and Michalis Kokologiannakis and Viktor Vafeiadis},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {POPL},
  year = {2025},
  doi = {10.1145/3704911}
}