Proving secure compilation of partial programs typically requires back-translating an attack against the compiled program to an attack against the source program. To prove back-translation, one can syntactically translate the target attacker to a source one -- i.e., syntax-directed back-translation -- or show that the interaction traces of the target attacker can also be emitted by source attackers -- i.e., trace-directed back-translation. Syntax-directed back-translation is not suitable when the target attacker may use unstructured control flow that the source language cannot directly represent. Trace-directed back-translation works with such syntactic dissimilarity because only the external interactions of the target attacker have to be mimicked in the source, not its internal control flow. Revealing only external interactions is, however, inconvenient when sharing memory via unforgeable pointers, since information about shared pointers stashed in private memory is not present on the trace. This made prior proofs unnecessarily complex, since the generated attacker had to instead stash all reachable pointers. In this work, we introduce more informative *data-flow traces*, combining the best of syntax- and trace-directed back-translation in a simpler technique that handles both syntactic dissimilarity and memory sharing well, and that is proved correct in Coq. Additionally, we develop a novel *turn-taking simulation* relation and use it to prove a recomposition lemma, which is key to reusing compiler correctness in such secure compilation proofs. We are the first to mechanize such a recomposition lemma in the presence of memory sharing. We use these two innovations in a secure compilation proof for a code generation compiler pass between a source language with structured control flow and a target language with unstructured control flow, both with safe pointers and components.
翻译:对部分程序进行安全编译通常需要将攻击对编成的程序进行反向翻译,对源程序进行攻击。为了证明反向翻译,可以将目标攻击者合成成源程序 -- -- 即:语法反向翻译 -- -- 或显示目标攻击者的互动痕迹也可以由源攻击者发出 -- -- 即,跟踪反向翻译。当目标攻击者可能使用源语言无法直接代表的非结构化控制流时,语法反向翻译不合适。为了证明反向翻译可以使目标攻击者变成同源程序不同。为了证明反向翻译可以将目标攻击者转换成一个源,即:即:攻击者只需在源内进行模拟反向反向翻译,而不是其内部控制流动。但是,如果仅将目标攻击者的记忆与不可预见的指针分享,则很难与私有记忆中隐藏的点有关的信息在追踪中出现。这在前一种不必要的复杂证据中,因为生成攻击者不得不将所有可达标的源关系隐藏所有源码关系。