Capability machines such as CHERI provide memory capabilities that can be used by compilers to provide security benefits for compiled code (e.g., memory safety). The existing C to CHERI compiler, for example, achieves memory safety by following a principle called "pointers as capabilities" (PAC). Informally, PAC says that a compiler should represent a source language pointer as a machine code capability. But the security properties of PAC compilers are not yet well understood. We show that memory safety is only one aspect, and that PAC compilers can provide significant additional security guarantees for partial programs: the compiler can provide security guarantees for a compilation unit, even if that compilation unit is later linked to attacker-provided machine code. As such, this paper is the first to study the security of PAC compilers for partial programs formally. We prove for a model of such a compiler that it is fully abstract. The proof uses a novel proof technique (dubbed TrICL, read trickle), which should be of broad interest because it reuses the whole-program compiler correctness relation for full abstraction, thus saving work. We also implement our scheme for C on CHERI, show that we can compile legacy C code with minimal changes, and show that the performance overhead of compiled code is roughly proportional to the number of cross-compilation-unit function calls.
翻译:诸如 CHERI 等能力机器提供存储能力,可供编译者用来为编译代码(例如内存安全)提供安全效益。例如,现有的 C 到 CHERI 编译者通过遵循一个称为“点点点作为能力”的原则(PAC)实现记忆安全。非正式地,PAC 说,一个编译者应该代表源语言指示器作为机器代码能力。但是,PAC 编译者的安全特性还不能很好地理解。我们显示,存储安全只是一个方面,而PAC 编译者可以为部分程序提供重要的额外安全保障:编译者可以为编译单位提供安全保障,即使该编译单位后来与攻击者提供的机器代码相联系。因此,本文是正式研究部分程序PAC 编译者安全的原则(PAC) 。我们证明这样一个编译者的模型是完全抽象的。 证据使用一种新颖的证明技术(dubbbbbed TrICL, 读滴滴), 编译者们应该具有广泛的兴趣,因为编译者可以重新利用整个程序编译器校准与完全抽象化的编程的校准关系,因此我们的编译C- 的编程的编程功能可以显示。