解锁环境假设在单元证明中的力量
Unlocking the Power of Environment Assumptions for Unit Proofs
AI总结:
本文提出vMocks,一种受单元测试模拟启发的环境模型框架,用于代码级形式验证,并实现SEAMOCK库,在Android TEE和mbedTLS上验证其补充现有模型的实用性。
摘要:
清晰阐述执行环境的假设对于代码级形式验证的成功应用至关重要。为环境指定模型的过程既费力又容易出错,通常需要领域专家参与。相比之下,当工程师编写单元测试时,他们经常使用模拟(tMocks)来定义被测函数运行环境的预期行为。这些tMocks描述了环境的行为方式,例如外部API调用的返回类型(无状态行为)或函数调用的正确顺序(有状态行为)。模拟框架已被证明是编写单元测试的高效工具。在我们的工作中,我们从tMocks中汲取灵感,并在形式验证领域引入了它们的对应物,我们称之为vMocks。vMocks提供了一个直观的框架,用于在进行代码级形式验证时指定一个合理的环境。我们为C程序的验证实现了一个名为SEAMOCK的vMock库。我们通过以下方式研究vMocks的实用性:首先,比较Android Trusty可信执行环境(TEE)开源项目通信层中的规范风格;其次,在mbedTLS的验证中,mbedTLS是一个广泛使用的开源C库,为嵌入式系统提供安全通信协议和加密原语。基于我们的经验,我们得出结论,vMocks补充了其他形式的环境模型。我们相信,vMocks能促进已经熟悉tMocks的开发人员采用代码级形式验证。
英文摘要:
Clearly articulating the assumptions of the execution environment is crucial for the successful application of code-level formal verification. The process of specifying a model for the environment can be both laborious and error-prone, often requiring domain experts. In contrast, when engineers write unit tests, they frequently employ mocks (tMocks) to define the expected behavior of the environment in which the function under test operates. These tMocks describe how the environment behaves, e.g., the return types of an external API call (stateless behaviour) or the correct sequence of function calls (stateful behaviour). Mocking frameworks have proven to be highly effective tools for crafting unit tests. In our work, we draw inspiration from tMocks and introduce their counterpart in the realm of formal verification, which we term vMocks. vMocks offer an intuitive framework for specifying a plausible environment when conducting code-level formal verification. We implement a vMock library for the verification of C programs called SEAMOCK. We investigate the practicality of vMocks by, first, comparing specifications styles in the communication layer of the Android Trusty Trusted Execution Environment (TEE) open source project, and second, in the verification of mbedTLS, a widely used open source C library that provides secure communication protocols and cryptography primitives for embedded systems. Based on our experience, we conclude that vMocks complement other forms of environment models. We believe that vMocks ease adoption of code-level formal verification among developers already familiar with tMocks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。