CHERI-C extends the C programming language by adding hardware capabilities, ensuring a certain degree of memory safety while remaining efficient. Capabilities can also be employed for higher-level security measures, such as software compartmentalization, that have to be used correctly to achieve the desired security guarantees. As the extension changes the semantics of C, new theories and tooling are required to reason about CHERI-C code and verify correctness. In this work, we present a formal memory model that provides a memory semantics for CHERI-C programs. We present a generalised theory with rich properties suitable for verification and potentially other types of analyses. Our theory is backed by an Isabelle/HOL formalisation that also generates an OCaml executable instance of the memory model. The verified and extracted code is then used to instantiate the parametric Gillian program analysis framework, with which we can perform concrete execution of CHERI-C programs. The tool can run a CHERI-C test suite, demonstrating the correctness of our tool, and catch a good class of safety violations that the CHERI hardware might miss.
翻译:CHERI-C 扩展 C 编程语言, 增加硬件功能, 确保一定程度的记忆安全, 同时保持有效 。 还可以使用高层次的安全措施, 如软件分隔, 实现理想的安全保障。 随着扩展改变 C 的语义, 需要新的理论和工具来解释 CHERI- C 代码并核实正确性。 在这项工作中, 我们提出了一个正式的记忆模型, 为CHERI- C 程序提供一个存储语义。 我们提出了一个通用的理论, 其内容丰富, 适合核查, 并有可能进行其他类型的分析 。 我们的理论得到伊莎贝尔/ HOL 正规化的支持, 并产生一个可以执行的记忆模型的OCaml 实例 。 随后, 校验和提取的代码被用于即时化吉利安分数程序分析框架, 我们可以用它来进行具体执行CHERI- C 程序。 该工具可以运行一个 CHERI- C 测试套, 显示我们的工具的正确性, 并捕捉到一种良好的安全违规情况, CHERI 硬件可能错过 。