paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Verifying correct usage of context-free API protocols

验证上下文无关 API 协议的正确使用
POPL 5(POPL)2021匹配度 3/10 · 该论文属于传统程序验证/静态分析工作(CFG 过近似 + 语言包含检查 + 精化),有理论形式化与工具实现,但不涉及 LLM/Agent、浮点分析或贝叶斯程序分析,未命中用户画像的任何核心交叉方向,仅作为静态分析技术在领域上略有邻近。引用 12 inbox
Kostas Ferles, Jon Stephens, Isil Dillig
crossref: 2026-09-10

AI 速览

一句话:提出用 CFG 过近似程序 API 调用序列并做语言包含检查与精化,验证上下文无关 API 协议使用。

许多实际库(如可重入锁、GUI 框架、序列化库)要求客户端按上下文无关规范调用 API。本文提出验证此类 API 协议正确用法的技术:用上下文无关文法(CFG)过近似程序可行的 API 调用序列,并检查其与规范的语言包含。由于 CFG 抽象可能不精确,作者提出精化方法,从包含查询反例中向文法引入新非终结符和产生式,同时保持过近似。在工具 CFPChecker 中实现,并在 10 个使用至少一个上下文无关 API 的流行 Java 应用上评估。结果显示,它能验证正确客户端的 API 使用、为错误客户端产生反例;与三个基线相比,可验证现有工具无法触及的安全属性。

问题
如何验证客户端对上下文无关 API 协议(如可重入锁、GUI、序列化库)的调用序列符合规范。
方法
用 CFG 过近似程序可行 API 调用序列,检查与规范的语言包含;针对抽象不精确,从包含查询反例出发精化 CFG,引入新非终结符与产生式并保持过近似。
评估
在 CFPChecker 中实现,对 10 个流行 Java 应用评估;正确客户端可被验证,错误客户端产生反例,并与三个基线比较,展示能验证现有工具无法处理的安全属性。
原文摘要(Abstract)

Several real-world libraries (e.g., reentrant locks, GUI frameworks, serialization libraries) require their clients to use the provided API in a manner that conforms to a context-free specification. Motivated by this observation, this paper describes a new technique for verifying the correct usage of context-free API protocols. The key idea underlying our technique is to over-approximate the program’s feasible API call sequences using a context-free grammar (CFG) and then check language inclusion between this grammar and the specification. However, since this inclusion check may fail due to imprecision in the program’s CFG abstraction, we propose a novel refinement technique to progressively improve the CFG. In particular, our method obtains counterexamples from CFG inclusion queries and uses them to introduce new non-terminals and productions to the grammar while still over-approximating the program’s relevant behavior. We have implemented the proposed algorithm in a tool called CFPChecker and evaluate it on 10 popular Java applications that use at least one API with a context-free specification. Our evaluation shows that CFPChecker is able to verify correct usage of the API in clients that use it correctly and produces counterexamples for those that do not. We also compare our method against three relevant baselines and demonstrate that CFPChecker enables verification of safety properties that are beyond the reach of existing tools.

链接与引用

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

BibTeX
@article{paperbot1145,
  title = {Verifying correct usage of context-free API protocols},
  author = {Kostas Ferles and Jon Stephens and Isil Dillig},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {5},
  number = {POPL},
  year = {2021},
  doi = {10.1145/3434298}
}