A System for Generating Static Analyzers for Machine Instructions

Junghee Lim, Thomas W. Reps

Introduction

Static analysis of binary executables is a critical task for security auditing, bug finding, and reverse engineering. However, building these tools is notoriously difficult because binaries are tied to specific hardware Instruction Set Architectures (ISAs) like x86, ARM, or PowerPC. Traditionally, developers had to manually hard-code the semantics of hundreds of complex instructions for every new analysis and every new architecture. This manual process is not only error-prone and inconsistent but also creates a massive engineering bottleneck, requiring $M \times N$ effort to create $M$ types of analysis for $N$ different instruction sets.

The TSL Framework

To address these challenges, the authors introduce TSL (Transformer Specification Language), a system designed to automatically generate multiple static analyzers from a single formal description of a machine instruction set. The core innovation lies in decoupling the concrete operational semantics of an ISA from the abstract interpretations required for different analyses.

The TSL System architecture facilitates the generation of N analysis components from M instruction set specifications.

The system consists of two primary roles:

  1. ISS Developer: Defines the concrete behavior of each instruction in TSL, specifying how it affects registers, flags, and memory.
  2. Analysis Developer: Defines an interpretation for TSL’s basic operations (e.g., addition, bit-shifting, or memory access).

By defining these interpretations once, the TSL system can automatically "re-interpret" the concrete ISA specification to generate abstract transformers—the mathematical functions describing how an instruction affects the abstract state of a program. This reduces the total development effort from $M \times N$ to $M + N$.

Automated Transformer Generation

The power of TSL is most evident in its ability to generate diverse transformers from the same specification. For instance, a single "add" instruction can be transformed into a Value-Set Analysis (VSA) transformer for tracking intervals, a Def-Use Analysis (DUA) transformer for tracking data dependencies, or a Quantified Formula Bit-Vector (QFBV) transformer for symbolic execution.

Examples of generated abstract transformers for the x86 'add ebx, eax' instruction across different analysis domains.

This approach ensures semantic consistency across all analysis phases. Furthermore, the TSL compiler eliminates the "fatigue factor" associated with manual coding. While a human programmer might over-simplify the 500th variation of an x86 instruction, the TSL system consistently applies the full logic of the specification, often resulting in higher precision than hand-coded tools.

Evaluation and Impact

The authors evaluated TSL using nearly complete specifications for Intel IA32 (x86) and PowerPC32. In a precision comparison for Affine-Relation Analysis (ARA), the TSL-generated version was more precise than the hand-coded version in 218 out of 542 cases.

The productivity gains were equally significant. Hand-coding eight analysis phases for an x86 tool historically took approximately 20 man-months. With TSL, the same results were achieved in roughly one man-month of coding interpretations, plus 20 days for the ISA specification. Retargeting to PowerPC took only four days to write the specification, after which the entire suite of analyzers was immediately available.

Conclusion

TSL represents a significant step forward in making binary analysis tools more scalable and reliable. By automating the generation of abstract transformers, it allows researchers to focus on developing new analysis techniques rather than wrestling with ISA complexities. Future work includes extending TSL to support high-level languages and improving precision for architectures with heavy conditional execution, such as ARM.

Summary updated

BibTeX
@inproceedings{lim2008system,
  author = {Junghee Lim and Thomas W. Reps},
  title = {{A System for Generating Static Analyzers for Machine Instructions}},
  booktitle = {CC},
  year = {2008},
  doi = {10.1007/978-3-540-78791-4\_3},
}
Figure