[Paper Review] SBT-instrumentation: A Tool for Configurable Instrumentation of LLVM Bitcode
This paper presents sbt-instrumentation, a configurable LLVM bitcode instrumentation tool that enables phase-based, plugin-integrated instrumentation for program analysis. It allows users to define custom instrumentation rules via JSON, insert function calls before/after matched instructions, and conditionally apply instrumentation using results from external static analyses—reducing inserted instructions by over 85% in memory safety checks.
The paper describes a member of the Symbiotic toolbox called sbt-instrumentation, which is a tool for configurable instrumentation of LLVM bitcode. The tool enables a user to specify patterns of instructions and to define functions whose calls will be inserted before or after instructions that match the patterns. Moreover, the tool offers additional functionality. First, the instrumentation can be divided into phases in order to pass information acquired in an earlier phase to the later phases. Second, it can utilize results of some external static analysis by connecting it as a plugin. The sbt-instrumentation tool has been developed as the part of Symbiotic responsible for inserting memory safety checks. However, its configurability opens the way to use it for many various purposes.
Motivation & Objective
- To address the lack of flexible, reusable instrumentation tools for LLVM bitcode in program analysis and verification.
- To reduce the performance overhead of instrumentation by minimizing redundant checks through static analysis integration.
- To enable phased instrumentation where later phases use information gathered from earlier ones.
- To provide a general-purpose, extensible framework for configurable instrumentation beyond memory safety.
- To support integration with external static analyses via plugins to conditionally apply instrumentation rules.
Proposed method
- The tool uses a JSON configuration file to define instrumentation rules, specifying functions to insert, insertion points (before/after), and matching patterns on LLVM instructions.
- Instrumentation is performed in multiple phases, with each phase able to access and use information (flags, values) gathered from previous phases.
- Conditions in rules can query flag states or invoke external static analysis plugins (e.g., for pointer or range analysis) to determine whether a rule should be applied.
- The tool supports defining instrumentation functions in LLVM or C, with automatic compilation to LLVM bitcode.
- It integrates with the Symbiotic verification toolbox and supports both raw LLVM bitcode and C source input via a wrapper script.
- The tool leverages the JsonCpp library for JSON parsing and is implemented in C++ with support for LLVM 3.9.1 or higher.
Experimental results
Research questions
- RQ1How can LLVM bitcode instrumentation be made configurable and reusable across diverse program analysis tasks?
- RQ2Can phased instrumentation reduce the number of inserted instructions while preserving correctness?
- RQ3To what extent can external static analysis results be effectively used to conditionally enable instrumentation?
- RQ4How does configurable instrumentation impact performance and scalability in memory safety checking?
- RQ5Can the same instrumentation framework be extended to support multiple verification tasks beyond memory safety?
Key findings
- The sbt-instrumentation tool enables configurable, phase-based instrumentation of LLVM bitcode using user-defined rules in JSON format.
- By using static analysis results (e.g., pointer or range analysis) to conditionally insert checks, the tool reduced the number of inserted instructions by over 85% in memory safety checks.
- Phased instrumentation allows later phases to use information gathered in earlier phases, such as tracking whether malloc was called, to avoid unnecessary checks.
- The tool supports integration with external static analyses via plugins, enabling conditional instrumentation based on analysis outcomes.
- The tool is distributed under the Apache 2.0 license and is part of the Symbiotic verification toolbox, with predefined configurations for memory safety and signed integer overflow checking.
- The tool is implemented in C++ with JSON configuration, supports both LLVM bitcode and C source input, and includes a Python wrapper script for ease of use.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.