arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.12093cs.SEcs.PL
收藏

检查化:一种测试静态分析正确性的实用方法

Checkification: A Practical Approach for Testing Static Analysis Truths

Daniela Ferreiro, Ignacio Casso, Jose F. Morales, Pedro López-García, Manuel V. Hermenegildo

AI总结:

本文提出一种基于Ciao断言框架的静态/动态混合检查方法,通过组合静态分析器、运行时断言检查、随机测试生成和单元测试来测试抽象解释静态分析器,并在CiaoPP上成功发现并修复多个缺陷。

摘要:

静态分析是许多现代软件开发工具的重要组成部分。不幸的是,静态分析器日益增长的复杂性使其编码容易出错。即使是基于严格数学技术(如抽象解释)的分析工具也无法避免缺陷。如果要将其部署到生产编译器和开发环境中,确保软件分析器的正确性和可靠性至关重要。虽然编译器验证已经取得了显著成功,但静态分析工具的形式化验证仍然相对未被探索。在本文中,我们提出了一种测试基于抽象解释的静态分析器的方法。概括而言,该方法包括在一组基准测试上检查静态推断出的属性是否在动态执行中得到满足。我们方法的主要优势在于其简单性,这直接源于将其置于Ciao基于断言的验证框架内,以及其静态/动态混合断言检查方法。我们证明,在此设置下,通过组合框架中已有的以下组件,可以以很少的工作量测试分析器:1)静态分析器,其输出结果为穿插了断言的原始程序源代码;2)断言运行时检查机制,该机制对程序进行插桩以确保在运行时没有任何断言被违反;3)随机测试用例生成器,它生成满足断言前置条件中属性的随机测试用例;以及4)单元测试框架,它执行这些测试用例。我们已将我们的方法应用于CiaoPP静态分析器,以合理的开销识别出许多缺陷。这些缺陷大多已被修复或确认,帮助我们检测到一系列错误,不仅涉及分析可靠性,还涉及框架的其他方面。

英文摘要:

Static analysis is an essential component of many modern software development tools. Unfortunately, the ever-increasing complexity of static analyzers makes their coding error-prone. Even analysis tools based on rigorous mathematical techniques, such as abstract interpretation, are not immune to bugs. Ensuring the correctness and reliability of software analyzers is critical if they are to be inserted in production compilers and development environments. While compiler validation has seen notable success, formal validation of static analysis tools remains relatively unexplored. In this paper, we propose a method for testing abstract interpretation-based static analyzers. Broadly, it consists in checking, over a suite of benchmarks, that the properties inferred statically are satisfied dynamically. The main advantage of our approach lies in its simplicity, which stems directly from framing it within the Ciao assertion-based validation framework, and its blended static/dynamic assertion checking approach. We demonstrate that in this setting, the analysis can be tested with little effort by combining the following components already present in the framework: 1) the static analyzer, which outputs its results as the original program source with assertions interspersed; 2) the assertion run-time checking mechanism, which instruments a program to ensure that no assertion is violated at run time; 3) the random test case generator, which generates random test cases satisfying the properties present in assertion preconditions; and 4) the unit-test framework, which executes those test cases. We have applied our approach to the CiaoPP static analyzer, resulting in the identification of many bugs with reasonable overhead. Most of these bugs have been either fixed or confirmed, helping us detect a range of errors not only related to analysis soundness but also within other aspects of the framework.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑