TL;DR
This paper introduces Amurth, a tool that automatically synthesizes "best" abstract transformers for static analysis. By treating the construction of these components as a program-synthesis problem, the authors eliminate the need for error-prone manual implementation and successfully identified several soundness bugs in widely used existing analysis frameworks.
What Problem Does This Paper Address?
In the world of static analysis (specifically Abstract Interpretation), we want to predict how a program behaves without actually running it. To do this, we run the program over "abstract values" (like saying a variable is in the interval $[0, 10]$ rather than knowing its exact value is $5$).
The core logic of these analyzers relies on abstract transformers: functions that define how a specific operation (like addition or string concatenation) behaves on these abstract values. Historically, these transformers are written by hand. This is a "dark art"—it is incredibly difficult to ensure a manual transformer is both sound (it never lies about what the program might do) and most-precise (it provides the tightest possible prediction). Mistakes lead to analyzers that either miss bugs or produce too many "false alarms."
Methods
The authors propose a framework that treats transformer construction like a compiler treats code. The user provides:
- Concrete Semantics: A formal logic specification of the operation (e.g., how
abs(x)works on integers). - Abstract Domain: The lattice of abstract values (e.g., Intervals).
- DSL (Domain-Specific Language): The language in which the transformer should be written.
The Amurth Algorithm: The engine uses a novel synthesis approach that interleaves two CEGIS (Counter-Example Guided Inductive Synthesis) loops:
- The Soundness Loop: Searches for "positive counterexamples"—cases where the current synthesized transformer is too "small" and misses valid concrete states.
- The Precision Loop: Searches for "negative counterexamples"—cases where the transformer is too "large" and a more precise version exists.
A key innovation is the use of Occam’s Razor via a MaxSatSynthesize procedure. When positive and negative examples conflict (which happens because the "best" transformer might not be perfectly expressible in the chosen DSL), the algorithm prioritizes soundness and drops the minimum number of negative examples to maintain a consistent, valid solution.
Datasets
The authors evaluated Amurth by synthesizing 57 transformers across two major categories:
- String Domains: Based on the SAFEstr analyzer, covering domains like Constant String, String Set ($SS_k$), Character Inclusion ($CI$), and Prefix-Suffix ($PS$).
- Interval Domains: Based on work by Navas et al., covering Unsigned, Signed, and Wrapped (bit-vector) intervals.
These benchmarks represent real-world challenges in static analysis for JavaScript and low-level C code.
Key Insights and Ideas
- Synthesis as a Design-Time Tool: Unlike previous methods that call an SMT solver during program analysis (which is slow), Amurth synthesizes the transformer code once at design time. The result is a simple, fast snippet of code that can be integrated directly into an analyzer.
- The "Best" Transformer Guarantee: The algorithm is mathematically guaranteed to find the most precise transformer expressible within the provided DSL.
- Bugs in the Wild: The most striking "aha moment" was discovering that even expert-written, peer-reviewed transformers in established tools had soundness bugs. For example, the
trimoperation in the $CI$ domain of SAFEstr was found to be unsound, potentially leading the analyzer to incorrect conclusions.
Key Results
- Efficiency: Most transformers were synthesized in under 10 minutes (ranging from 3.7s to ~1,983s).
- Bug Discovery: Amurth found four soundness bugs in existing frameworks (three in SAFEstr and one in the Navas et al. interval library).
- Performance Parity: Once the manual bugs were fixed, the synthesized transformers performed identically to the hand-written ones in terms of analysis time and precision when run on full-scale benchmarks.
- Complexity: The tool successfully synthesized highly non-trivial logic, such as the
xoroperation for wrapped intervals, which involves complex bit-manipulation and interval splitting.
Limitations and Future Work
- DSL Dependency: The quality of the synthesized transformer depends on the user-provided DSL. If the DSL is too restrictive, the transformer will be imprecise; if it's too complex, the synthesis might time out.
- Scalability to Complex Operations: While it handles bitwise and string ops well, extremely complex operations might require more "templates" or implementation sketches to guide the synthesizer.
- Closed-Box Functions: Currently, Amurth requires a formal logical specification of the operation. The authors suggest future work could involve using test generators (fuzzers) to infer transformers for "closed-box" library functions where source code or formal specs aren't available.
Summary updated