Next-Generation Intermediate Representations for Binary Code Analysis


Cite item

Full Text

Open Access Open Access
Restricted Access Access granted
Restricted Access Subscription Access

Abstract

Many binary code analysis tools rely on intermediate representation (IR) derived from a binary code, instead of working directly with machine instructions. In this paper, we first consider binary code analysis problems that benefit from IR and compile a list of requirements that the IR suitable for solving these problems should meet. Generally speaking, a universal binary analysis platform requires two principal components. The first component is a retargetable instruction decoder that utilizes external specifications to describe target instruction sets. External specifications facilitate maintenance and allow one to quickly implement support for new instruction sets. We analyze some of the most popular instruction set architectures (ISAs), including those used in microcontrollers, and from that compile a list of requirements for the retargetable decoder. We then overview existing multi-ISA decoders and propose our vision of a more generic approach, based on a multi-layer directed acyclic graph that describes the decoding process in universal terms. The second component of the analysis platform is the actual architecture-neutral IR. In this paper, we describe such IRs and propose Pivot 2, an IR that is low-level enough to be easily constructed from decoded machine instructions, also being easy to analyze. The main features of Pivot 2 are explicit side effects, SSA variables, simpler alternative to phi-functions, and extensible elementary operation set at the core. This IR also supports machines that have multiple memory address spaces. Finally, we propose a way to tie the decoder and the IR together to fit them to most of the binary code analysis tasks through abstract interpretation on top of the IR. The proposed scheme takes into account various aspects of target architectures that are overlooked in many other works, including pipeline specifics (handling of delay slots, hardware loop support, etc.), exception and interrupt management, and generic address space model, in which accesses may have arbitrary side effects due to memory-mapped devices or other non-trivial behavior of the memory system.

About the authors

M. A. Solovev

Ivannikov Institute for System Programming, Russian Academy of Sciences; Moscow State University

Author for correspondence.
Email: icee@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004; Moscow, 119991

M. G. Bakulin

Ivannikov Institute for System Programming, Russian Academy of Sciences

Author for correspondence.
Email: bakulinm@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004

M. S. Gorbachev

Ivannikov Institute for System Programming, Russian Academy of Sciences

Author for correspondence.
Email: sadbear@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004

D. V. Manushin

Ivannikov Institute for System Programming, Russian Academy of Sciences; Moscow State University

Author for correspondence.
Email: dman95@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004; Moscow, 119991

V. A. Padaryan

Ivannikov Institute for System Programming, Russian Academy of Sciences; Moscow State University

Author for correspondence.
Email: vartan@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004; Moscow, 119991

S. S. Panasenko

Ivannikov Institute for System Programming, Russian Academy of Sciences

Author for correspondence.
Email: spanasenko@ispras.ru
Russian Federation, ul. Solzhenitsyna 25, Moscow, 109004

Supplementary files

Supplementary Files
Action
1. JATS XML

Copyright (c) 2019 Pleiades Publishing, Ltd.