Program Analysis via Multiple Context Free Language Reachability
Abstract
Context-free language (CFL) reachability is a standard approach in static analyses, where the analysis question is phrased as a language reachability problem on a graph wrt a CFL L. While CFLs lack the expressiveness needed for high precision, common formalisms for context-sensitive languages are such that the corresponding reachability problem is undecidable. Are there useful context-sensitive language-reachability models for static analysis? In this paper, we introduce Multiple Context-Free Language (MCFL) reachability as an expressive yet tractable model for static program analysis. MCFLs form an infinite hierarchy of mildly context sensitive languages parameterized by a dimension and a rank . We show the utility of MCFL reachability by developing a family of MCFLs that approximate interleaved Dyck reachability, a common but undecidable static analysis problem. We show that MCFL reachability be computed in time on a graph of nodes when , and time when . Moreover, we show that when , the membership problem has a lower bound of based on the Strong Exponential Time Hypothesis, while reachability for has a lower bound of based on the combinatorial Boolean Matrix Multiplication Hypothesis. Thus, for , our algorithm is optimal within a factor for all levels of the hierarchy based on . We implement our MCFL reachability algorithm and evaluate it by underapproximating interleaved Dyck reachability for a standard taint analysis for Android. Used alongside existing overapproximate methods, MCFL reachability discovers all tainted information on 8 out of 11 benchmarks, and confirms of the reachable pairs reported by the overapproximation on the remaining 3. To our knowledge, this is the first report of high and provable coverage for this challenging benchmark set.
Cite
@article{arxiv.2411.06383,
title = {Program Analysis via Multiple Context Free Language Reachability},
author = {Giovanna Kobus Conrado and Adam Husted Kjelstrøm and Andreas Pavlogiannis and Jaco van de Pol},
journal= {arXiv preprint arXiv:2411.06383},
year = {2024}
}
Comments
Accepted at POPL 2024