论文标题

检查c的正式模型

A Formal Model of Checked C

论文作者

Li, Liyi, Liu, Yiyun, Postol, Deena L., Lampropoulos, Leonidas, Van Horn, David, Hicks, Michael

论文摘要

我们提出了一个正式的检查C的模型,该C的CALECT的方言旨在执行空间记忆安全。我们的模型特别注意动态大小的,潜在的无效终止阵列的语义。我们在COQ中正式化了该模型,并证明可以将任何空间内存安全错误归咎于未检查的程序的部分。这是一个检查的C功能,支持增量移植和向后兼容。尽管我们的模型的操作语义使用注释(“脂肪”)指针来执行空间安全,但我们表明可以安全地删除此类注释:使用PLT Redex,我们将模型的可执行版本正式化,并从其模型的可执行版本中进行编译程序,并使用其无效的C like语言,并使用随机测试,并使用随机测试来列出生成代码的代码符合原始代码的代码。最后,我们在Redex模型中开发了一个定制的随机生成器,用于使用良好且几乎是井井有条的术语,并使用它来搜索模型和Clang Checked C实现之间的不一致之处。我们发现这些步骤是共同开发A语言(检查C仍在开发中)和它的核心模型的有用方法。

We present a formal model of Checked C, a dialect of C that aims to enforce spatial memory safety. Our model pays particular attention to the semantics of dynamically sized, potentially null-terminated arrays. We formalize this model in Coq, and prove that any spatial memory safety errors can be blamed on portions of the program labeled unchecked; this is a Checked C feature that supports incremental porting and backward compatibility. While our model's operational semantics uses annotated ("fat") pointers to enforce spatial safety, we show that such annotations can be safely erased: Using PLT Redex we formalize an executable version of our model and a compilation procedure from it to an untyped C-like language, and use randomized testing to validate that generated code faithfully simulates the original. Finally, we develop a custom random generator for well-typed and almost-well-typed terms in our Redex model, and use it to search for inconsistencies between our model and the Clang Checked C implementation. We find these steps to be a useful way to co-develop a language (Checked C is still in development) and a core model of it.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源