论文标题
验证正确使用无上下文的API协议(扩展版本)
Verifying Correct Usage of Context-Free API Protocols (Extended Version)
论文作者
论文摘要
几个现实世界中的库(例如,重入锁,GUI框架,序列化库)要求其客户以符合无上下文规范的方式使用提供的API。在这一观察结果的推动下,本文介绍了一种新技术,用于验证无上下文API协议的正确使用。我们技术基础的关键思想是使用无上下文的语法(CFG)过度鉴定该程序的可行API调用序列,然后在此语法和规范之间进行对话。但是,由于该程序的CFG抽象不精确可能会失败,因此我们提出了一种新颖的改进技术来逐步改善CFG。特别是,我们的方法从CFG包含查询中获取反例,并使用它们将新的非末端和生产引入语法,同时仍然过度评估该程序的相关行为。 我们已经在称为CFPChecker的工具中实现了所提出的算法,并在10个流行的Java应用程序上对其进行了评估,该应用程序至少使用一个具有无上下文规范的API。我们的评估表明,CFPChecker能够在正确使用它的客户中验证API的正确用法,并为不使用的客户提供反例。我们还将我们的方法与三个相关基线进行了比较,并证明CFPCHECKER可以验证现有工具无法实现的安全性。
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.