一句话:提出 WYTIWYG,用插桩动态分析精确恢复提升二进制中的局部变量,重编译后性能提升 1.18–1.22 倍。
无源码的专有或遗留程序无法受益于现代编译器技术,二进制重编译器通过将可执行文件提升到编译器 IR 再下降回可执行形式来弥合这一差距。然而已有方法无法足够精确地恢复提升后程序中的函数局部变量,只能依赖在部分程序上失效的启发式或导致结果不精确的保守过近似,这阻碍了性能优化等编译器应用。本文提出 WYTIWYG,将局部变量恢复分解为一系列基于插桩的动态二进制分析,全自动进行并保持用户输入下的功能正确性。作者在 SPECint 2006 上进行广泛评估,与两个先前发表的先进二进制重编译器直接比较,处理由最新编译器编译的完全优化商业二进制。以重编译二进制的性能作为 IR 质量的指标,该方法平均显著优于同类重编译器 1.18 倍;对于旧编译器优化的遗留二进制,更是加速达 1.22 倍。
Users of proprietary and/or legacy programs without vendor support are denied the significant advances in compiler technologies of the past decades. Adapting these technologies to operate directly on binaries without source code is often infeasible. Binary recompilers attempt to bridge this gap by "lifting" binary executables to compiler-level intermediate representations (IR) and "lowering" them back down to executable form, enabling application of the full range of analyses and transformations available in modern compiler infrastructures. Past approaches could not recover local variables in lifted programs with sufficient precision, which is a necessary prerequisite for many compiler-related applications, including performance optimization. They have relied on heuristics failing on certain input programs, or on conservative over-approximations yielding imprecise results. In this paper, we present a novel approach, WYTIWYG, to recover function-local variables within lifted binaries. Our approach is fully automated and preserves functionality for user-provided inputs. This is accomplished by decomposing the recovery of local variables into a series of instrumentation-based dynamic binary analyses. We conduct an extensive set of careful evaluations on the SPECint 2006 benchmark suite, including direct comparisons with two previously published state-of-the-art binary recompilers. Our approach recompiles fully optimized commercial off-the-shelf binaries compiled with the latest compilers. Using performance of recompiled binaries as an indicator of IR-quality, our approach significantly outperforms similar recompilers by 1.18x on average. Furthermore, WYTIWYG accelerates legacy binaries optimized by older compilers by an astounding 1.22x.
@inproceedings{ParzefallDHF24,
title = {What You Trace is What You Get: Dynamic Stack-Layout Recovery for Binary Recompilation},
author = {Fabian Parzefall and Chinmay Deshpande and Felicitas Hetzelt and Michael Franz},
booktitle = {ASPLOS},
year = {2024},
doi = {10.1145/3620665.3640371}
}