一句话:提出以线性能力在运行时表示分离逻辑资源,并构造完全抽象编译器,从而在验证代码与不可信模块边界动态检查契约。
分离逻辑能对命令式程序进行模块化静态验证,但在已验证模块与不可信模块的边界上动态检查其契约很困难,尤其要防止已验证模块的外部调用访问其当前拥有的内存资源。本文提出利用能力(capabilities)进行动态契约检查,并特别采用硬件强制不可复制的线性能力。作者将方法形式化为一个完全抽象编译器:从静态验证的源语言编译到支持线性能力的目标语言。核心思想是,用线性能力在运行时表示空间分离逻辑谓词描述的内存资源;编译器由分离逻辑证明指导,根据源程序证明决定如何把内存访问编译为线性能力访问。完全抽象性保证编译后的已验证模块可与不可信目标模块交互,如同它们也由已验证代码编译而来。
Separation logic is a powerful program logic for the static modular verification of imperative programs. However, dynamic checking of separation logic contracts on the boundaries between verified and untrusted modules is hard, because it requires one to enforce (among other things) that outcalls from a verified to an untrusted module do not access memory resources currently owned by the verified module. This paper proposes an approach to dynamic contract checking by relying on support for capabilities, a well-studied form of unforgeable memory pointers that enables fine-grained, efficient memory access control. More specifically, we rely on a form of capabilities called linear capabilities for which the hardware enforces that they cannot be copied. We formalize our approach as a fully abstract compiler from a statically verified source language to an unverified target language with support for linear capabilities. The key insight behind our compiler is that memory resources described by spatial separation logic predicates can be represented at run time by linear capabilities. The compiler is separation-logic-proof-directed: it uses the separation logic proof of the source program to determine how memory accesses in the source program should be compiled to linear capability accesses in the target program. The full abstraction property of the compiler essentially guarantees that compiled verified modules can interact with untrusted target language modules as if they were compiled from verified code as well.
@article{paperbot588,
title = {Linear capabilities for fully abstract compilation of separation-logic-verified code},
author = {Thomas Van Strydonck and Frank Piessens and Dominique Devriese},
journal = {Proceedings of the ACM on Programming Languages},
volume = {3},
number = {ICFP},
year = {2019},
doi = {10.1145/3341688}
}