arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1603.05495cs.PLcs.LO
收藏

机器码的多态类型推断

Polymorphic Type Inference for Machine Code

Matthew Noonan, Alexey Loginov, David Cok

摘要:

对于许多编译语言,源代码级别的类型在编译过程的早期就被擦除。因此,进一步的编译器遍数可能会将类型安全的源代码转换为类型不安全的机器码。原始源代码中的类型不安全习惯用法和类型不安全优化意味着剥离的二进制文件中的类型信息基本上不存在。通过在剥离的机器码上执行类型推断来恢复高级类型的问题被称为类型重构,并且提供了支持逆向工程和反编译的有用能力。在本文中,我们激励和开发一个新的类型系统和算法的机器代码类型推断。这个类型系统的特征是通过调查广泛的常见源代码和机器代码习惯用法,建立一个类型重建的挑战性案例目录来开发的。我们发现,这些习惯用法对类型系统提出了一组复杂的要求,并引入了递归约束多态类型等特性。我们所识别的许多特性通常只在高级函数式语言所使用的表达性强且功能强大的类型系统中才能看到。使用这些类型系统的功能作为指导方针,我们已经开发了Retypd:一个新的静态类型推理算法的机器码,支持递归类型,多态性和子类型。Retypd产生比现有算法更准确的推断类型,同时还支持新功能,例如以98%的召回率重建指针常量注释。Retypd可以在比现有技术更弱的程序表示上操作,从而消除了对可能无法计算的高质量指向信息的需求。

英文摘要:

For many compiled languages, source-level types are erased very early in the compilation process. As a result, further compiler passes may convert type-safe source into type-unsafe machine code. Type-unsafe idioms in the original source and type-unsafe optimizations mean that type information in a stripped binary is essentially nonexistent. The problem of recovering high-level types by performing type inference over stripped machine code is called type reconstruction, and offers a useful capability in support of reverse engineering and decompilation. In this paper, we motivate and develop a novel type system and algorithm for machine-code type inference. The features of this type system were developed by surveying a wide collection of common source- and machine-code idioms, building a catalog of challenging cases for type reconstruction. We found that these idioms place a sophisticated set of requirements on the type system, inducing features such as recursively-constrained polymorphic types. Many of the features we identify are often seen only in expressive and powerful type systems used by high-level functional languages. Using these type-system features as a guideline, we have developed Retypd: a novel static type-inference algorithm for machine code that supports recursive types, polymorphism, and subtyping. Retypd yields more accurate inferred types than existing algorithms, while also enabling new capabilities such as reconstruction of pointer const annotations with 98% recall. Retypd can operate on weaker program representations than the current state of the art, removing the need for high-quality points-to information that may be impractical to compute.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑