配置文件引导的多版本二进制重写
Profile-Guided, Multi-Version Binary Rewriting
摘要:
机器码的静态插装(也称为二进制重写)是一种强大的技术,但与编译器级插装相比,存在较高的运行时开销。最近的研究表明,在重写二进制文件时,工具可以实现接近于零的开销(不包括特定于应用程序的插装的开销)。然而,二进制重写工具的用户通常很难理解为什么他们的插装很慢,以及如何优化他们的插装。我们的灵感来自于传统的程序优化工作流程,在那里人们可以分析程序执行以识别性能热点,修改源代码或应用合适的编译器优化,甚至应用配置文件引导的优化。我们提出了配置文件引导的多版本二进制重写,以实现静态二进制插装的优化工作流程。我们的新技术包括三个组成部分。首先,我们增加现有的二进制重写,以支持调用路径分析,一个可以交互式地查看仪表成本和理解的调用上下文的成本。其次,我们提出了版本化结构二进制编辑,这是一种通用的二进制转换技术。第三,我们使用调用路径配置文件来指导二进制转换的应用。我们将我们的新技术应用于影子堆栈和基本块代码覆盖。我们的插装优化工作流程帮助我们识别了有关代码转换和插装数据布局的几个机会。我们在SPEC CPU 2017上的评估表明,阴影堆栈和块覆盖的几何开销分别从7.6%和161.3%降低到1.4%和4.0%。我们也取得了可喜的成果,Apache HTTP服务器上,影子堆栈开销从约20%减少到3.5%。
英文摘要:
The static instrumentation of machine code, also known as binary rewriting, is a power technique, but suffers from high runtime overhead compared to compiler-level instrumentation. Recent research has shown that tools can achieve near-to-zero overhead when rewriting binaries (excluding the overhead from the application specific instrumentation). However, the users of binary rewriting tools often have difficulties in understanding why their instrumentation is slow and how to optimize their instrumentation. We are inspired by a traditional program optimization workflow, where one can profile the program execution to identify performance hot spots, modify the source code or apply suitable compiler optimizations, and even apply profile-guided optimization. We present profile-guided, Multi-Version Binary Rewriting to enable this optimization workflow for static binary instrumentation. Our new techniques include three components. First, we augment existing binary rewriting to support call path profiling; one can interactively view instrumentation costs and understand the calling contexts where the costs incur. Second, we present Versioned Structure Binary Editing, which is a general binary transformation technique. Third, we use call path profiles to guide the application of binary transformation. We apply our new techniques to shadow stack and basic block code coverage. Our instrumentation optimization workflow helps us identify several opportunities with regard to code transformation and instrumentation data layout. Our evaluation on SPEC CPU 2017 shows that the geometric overhead of shadow stack and block coverage is reduced from 7.6% and 161.3% to 1.4% and 4.0%, respectively. We also achieve promising results on Apache HTTP Server, where the shadow stack overhead is reduced from about 20% to 3.5%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。