기본 정보
- 저자
- DOI
- 10.1007/s10009-025-00787-0
- 저널
- International Journal on Software Tools for Technology Transfer
- 발행년도
- 2025
- 발행기관
- Springer Science+Business Media
- 피인용수
- 1
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.1007/s10009-025-00787-0
- 토픽
- Advancements in Photolithography Techniques
- OpenAlex ID
- W4409446223
평가 내용
- 관련도
- 사업분야
- 모빌리티 소재 · (2) 샤무드(인공피혁)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '모빌리티 소재 > 샤무드(인공피혁)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
Abstract Interleaved Dyck Reachability is a standard, graph-based formulation of a plethora of static analyses that seek to be context- and field- sensitive, where each type of sensitivity is expressed via a CFL/Dyck language. Unfortunately, the problem is well known to be undecidable in general, and thus existing approaches resort to clever overapproximations. Recently, a mutual-refinement algorithm, that iteratively considers each of the two sensitivities in isolation until a fixpoint is reached, was shown to achieve high precision. In this work we present a more precise approximation of Interleaved Dyck Reachability, by extending the mutual-refinement algorithm in three general directions. First, we develop refined CFLs to express each type of sensitivity precisely, while simultaneously also lightly overapproximating the opposite type. Second, we modify the graph information in a way to highlight unreachable paths not previously captured by the algorithm. Third, we apply the resulting algorithm on an on-demand basis, which effectively masks out imprecision incurred by parts of the graph that are irrelevant for the query at hand. Our experiments show that the new approach offers significantly higher precision than the vanilla mutual-refinement algorithm and other common baselines; for a particularly challenging benchmark, we report, on average, $51\%$ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:mn>51</mml:mn> <mml:mi>%</mml:mi> </mml:math> of the reachable pairs compared to the most recent alternative.
본문 61,147자
본문 펼치기
https://doi.org/10.1007/s10009-025-00787-0
GENERAL
Special Issue: SOAP 2024
# CFL-based methods for approximating interleaved Dyck reachability
Giovanna Kobus Conrado <sup>1</sup> · Andreas Pavlogiannis <sup>2</sup>
Accepted: 4 April 2025 / Published online: 15 April 2025
© The Author(s) 2025
Abstract
Interleaved Dyck Reachability is a standard, graph-based formulation of a plethora of static analyses that seek to be _context-_
and _field-_ sensitive, where each type of sensitivity is expressed via a CFL/Dyck language. Unfortunately, the problem is
well known to be undecidable in general, and thus existing approaches resort to clever overapproximations. Recently, a
mutual-refinement algorithm, that iteratively considers each of the two sensitivities in isolation until a fixpoint is reached,
was shown to achieve high precision. In this work we present a more precise approximation of Interleaved Dyck Reachability,
by extending the mutual-refinement algorithm in three general directions. First, we develop refined CFLs to express each
type of sensitivity precisely, while simultaneously also lightly overapproximating the opposite type. Second, we modify the
graph information in a way to highlight unreachable paths not previously captured by the algorithm. Third, we apply the
resulting algorithm on an on-demand basis, which effectively masks out imprecision incurred by parts of the graph that are
irrelevant for the query at hand. Our experiments show that the new approach offers significantly higher precision than the
vanilla mutual-refinement algorithm and other common baselines; for a particularly challenging benchmark, we report, on
average, 51% of the reachable pairs compared to the most recent alternative.
Keywords CFL reachability · Static analysis · Graphs
1 Introduction
Static analyses are common techniques for inferring properties of a program prior to its execution. They may be used
to detect vulnerabilities and security issues, as well as for
optimizing code during compilation, making it, for example, run faster or use less memory. One common approach
is to create a graph _?_ = ( _?, ?_ ) that serves as a program
model [1]. Nodes in _?_ represent distinct, indivisible entities of the source code, such as variables, pointers, or code
blocks, and edges capture direct relationships between such
entities, such as control-flow between instructions or datadependence between variables. Static analyses then reduce
- G.K. Conrado
[gkc@connect.ust.hk](mailto:gkc@connect.ust.hk)
A. Pavlogiannis
[pavlogiannis@cs.au.dk](mailto:pavlogiannis@cs.au.dk)
1 Hong Kong University of Science and Technology, Clear Water
Bay, Hong Kong
2 Aarhus University, Aarhus, Denmark
to the algorithmic problem of finding paths in _?_ that satisfy
certain properties.
Dyck reachability In order to increase the precision of
the analysis, normally, not all paths in _?_ are treated as valid
approximations of program behavior. CFL/Dyck reachability
is a popular, generic graph-based formulation of a plethora
of static analyses following this scheme. Here, the edges of _?_
are labeled with opening and closing parenthesis symbols,
and reachability between nodes in _?_ is only considered when
witnessed by paths whose labels along the edges produce a
properly-balanced parenthesis string [2, 3].
Parentheses have been commonly used to increase the sensitivity, and thus the precision, of the analysis, modeling two
distinct features. In _context_ _sensitivity_, parentheses capture
sensitivity in calling contexts during whole-program analysis, by filtering out interprocedurally-invalid paths (see Fig. 1
for an example). This approach has found applications in a
wide range of interprocedural static analyses, including dataflow and shape analysis [4, 5], type-based flow analysis [6],
taint analysis [7], and data-dependence analysis [8].
Springer
Fig. 1 A data-dependence graph for whole-program analysis. Although _?_ reaches _?_, there is no dependence of _?_ on _?_, as the path
_?_ 1 : _?_ ⇝ _?_ does not correspond to any interprocedurally-valid execution. The label of _?_ 1 is (2 )3 and thus not properly balanced, so Dyck
reachability deems _?_ not reachable from _?_ . On the other hand, _?_ is
reachable from _?_ via a path _?_ 2 : _?_ ⇝ _?_ with properly balanced labels
(2 )2, which witnesses a true dependence of _?_ on _?_
Fig. 2 A data-dependence graph with composite objects and fields. We
have that _?_ depends on _?_, witnessed via a path labeled [1 ]1, capturing
this dependence via the field _?_ of _?_ . On the other hand, _?_ does not
depend on _?_ as the corresponding path has nonmatching labels [1 ]2
Similarly, in _field_ _sensitivity_, brackets are used to capture the flow of information through the fields of composite
objects (see Fig. 2 for an example, brackets work identically to parenthesis, but a different symbol is used to avoid
confusion). This approach is frequently used in points-to
analysis [1, 9].
Interleaved Dyck reachability Naturally, for a highprecision analysis, we desire both context- and fieldsensitivity. This leads to an _interleaved_ reachability problem, where the label of paths witnessing reachability is well
balanced with respect to both parentheses and brackets, but
the two types of symbols are _freely interleaved_ (see Fig. 3).
This approach has been used in many analysis applications,
such as alias analysis [10], points-to analysis [11, 12], typebased flow analysis [13], taint analysis [7], and value-flow
analysis [14], among others.
Unfortunately, Interleaved Dyck Reachability is known
to be undecidable [15, 16], thus applications like the above
resort to various overapproximations, such as approximating one of the languages with a regular language [17], using overapproximate algorithms based on linear conjunctive
languages [18], and intersecting the reachability information obtained for each type of sensitivity independently via
Synchronized Pushdown Systems [19]. The most recent development in this direction is a mutual-refinement algorithm
Springer
Fig. 3 A data-dependence graph for whole-program analysis with
composite objects and fields. Notice that _?_ reaches _?_ through a interprocedurally valid path labeled [ _?_ ( _?_ ] _?_ ) _?_, but _?_ does not depend
on _?_ since these variables do not flow correctly through their fields.
Similarly, _?_ reaches _?_ through a path labeled [ _?_ ( _?_ ] _?_ ) _?_ . In this case the
labels corresponding to the fields match, but the path is not interprocedurally valid. The path _?_ : _?_ ⇝ _?_ with label [ _?_ ( _?_ ] _?_ ) _?_, on the other
hand, is well balanced both in terms of context and field labels, thus the
value of _?_ is truly dependent on _?_
developed in [20], which roughly performs an iterative application of the intersection method until a fixpoint, and was
shown to be more precise than other baselines. Despite this
progress, none of the existing approximations is very precise,
and hence we consider this challenge in this work.
Our contribution We develop a new approach for approximating Interleaved Dyck Reachability, by means of extensions to the mutual-refinement algorithm of [20]. These extensions are presented in Sect. 4 and can be grouped in three
main approaches:
(1) We develop simple but stronger CFLs to express each
type of sensitivity precisely, while simultaneously also
overapproximating the opposite type using two efficient
conditions. In effect, each iteration of the mutual refinement becomes more precise as it reasons simultaneously
about both types of sensitivity (i.e., both parentheses and
brackets), albeit being precise on only one of them.
(2) We develop overapproximations that identify unreach
able pairs by selectively erasing graph data.
(3) We apply the resulting algorithms on-demand, by con
sidering each pair of nodes independently. This effectively filters out imprecision that is due to other nodes in
the graph, thereby leading to more precise results.
We also show that these approaches can be used simultaneously or separately. An experimental evaluation of our
approach on standard benchmarks shows that the combination of these techniques is considerably more precise than
the vanilla mutual-refinement and other common baselines.
Comparison to previous work An earlier version of this
work can be found in [21]. We expanded on our approach and
experimental evaluation. More specifically, changes include:
- Expanded the description of the extended parity conditions
in Sect. 4.1, explicitly defining its grammar.
- Added the two methods present in Sect. 4.2, which lead to
an even more precise analysis.
- Greatly expanded the experimental section (Sect. 5), by
measuring each method individually and reporting more
detailed information about the runtime trade-offs of each
technique.
- The final results were updated to reflect the new version of
the algorithm.
- Added Sect. 6, which presents previous related work.
2 Preliminaries
General notation Given some _?_ ∈ N, we let [ _?_ ] =
{1 _, . . ., ?_ }. For a set _?_, _?_ ( _?_ ) is a shorthand for _?_ ∈ _?_ . We
let _?_ be the empty string. Given an alphabet Σ, a subset
_?_ ⊆ Σ and a string _?_ ∈ Σ <sup>∗</sup>, we denote by _?_ ⇂ _?_ the projection
of _?_ to _?_, i.e., the subsequence of _?_ consisting of the letters
in _?_ .
Dyck language The Dyck language corresponds to the
language of labeled well-nested parenthesis. We use _??_ and
_~~?~~_ _?_ to represent labeled opening and closing parentheses, with
the labels ranging from 1 to some constant _?_ _?_ .
Formally, given a natural number _?_ _?_ ∈ N, the Dyck
language _?_ (Σ _?_ ) is the language over the alphabet Σ _?_ =
_?_ ∈[ _??_ ] <sup>{</sup> <sup>_?_</sup> _?_ <sup>_,_</sup> <sup>_~~?~~_</sup> _?_ <sup>}, consisting of strings contained in</sup> <sup>_?_</sup> <sup>, where</sup>
_?_ is the smallest set satisfying the following three conditions:
_?_ ( _?_ ) _,_ (1)
∀ _?_ ∈[ _?_ _?_ ] _,_ _?_ ( _???_ _~~?~~_ _?_ ) ← _?_ ( _?_ ) _,_ (2)
_?_ ( _?_ 1 _?_ 2) ← _?_ ( _?_ 1) _, ?_ ( _?_ 2) _._ (3)
In our examples, we may use ( _?_ for _??_ and ) _?_ for _~~?~~_ _?_, to
benefit readability.
Interleaved Dyck languages Given two natural numbers
_?_ _?, ??_ ∈ N, two disjoint alphabets Σ _?_ = <sup>�</sup> _?_ ∈[ _??_ ] <sup>{</sup> <sup>_?_</sup> _?_ <sup>_,_</sup> <sup>_~~?~~_</sup> _?_ <sup>} and</sup>
_?_ _?, ??_ ∈ N, two disjoint alphabets Σ _?_ = <sup>�</sup> _?_ ∈[ _??_ ] <sup>{</sup> <sup>_?_</sup> _?_ <sup>_,_</sup> <sup>_~~?~~_</sup> _?_ <sup>} and</sup>
Σ _?_ = <sup>�</sup> _?_ ∈[ _??_ ] <sup>{</sup> <sup>_?_</sup> _?_ <sup>_, ?_</sup> _?_ <sup>}, and the two corresponding Dyck lan-</sup>
Σ _?_ = <sup>�</sup> _?_ ∈[ _??_ ] <sup>{</sup> <sup>_?_</sup> _?_ <sup>_, ?_</sup> _?_ <sup>}, and the two corresponding Dyck lan-</sup>
guages _?_ (Σ _?_ ) and _?_ (Σ _?_ ), a string _?_ belongs to the interleaved language _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ) if _?_ ⇂ Σ _?_ ∈ _?_ (Σ _?_ ) and
_?_ ⇂ Σ _?_ ∈ _?_ (Σ _?_ ). In words, the substring of _?_ formed by its
characters in Σ _?_ (resp., Σ _?_ ) is in _?_ (Σ _?_ ) (resp., _?_ (Σ _?_ )).
Similarly to the interpretation of _??_ and _~~?~~_ _?_ as parentheses,
we interpret _??_ and _??_ as brackets [ _?_ and ] _?_ . Then, the interleaved Dyck language _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ) consists of strings
that may contain both labeled parenthesis and labeled brackets, e.g., [2 [1 (5)5 (2]1)2]2, and whose projection to parenthesis ((5)5 (2)2) and brackets ([2 [1]1]2) are properly balanced.
Language reachability Consider a labeled directed
graph _?_ = ( _?, ?,_ Σ), where _?_ is a set of nodes, Σ is an
alphabet, and _?_ ⊆ _?_ × _?_ × (Σ ∪{ _?_ }) is a set of partially
labeled edges. A path _?_ : _?_ ⇝ _?_ in _?_ is a sequence of
edges ( _?_ 1 _, ?_ 1 _, ?_ 1) _, . . .,_ ( _??, ??, ??_ ) such that _?_ 1 = _?_, _??_ = _?_,
∀ _?_ ∈[ _?_ ], ( _??, ??, ??_ ) ∈ _?_ and ∀ _?_ ∈[ _?_ - 1], _??_ = _??_ +1. We let
_?_ ( _?_ ) = _?_ 1 _?_ 2 _. . . ??_ be the label of _?_ .
Given a language _?_ ⊆ Σ <sup>∗</sup> and a graph _?_, the _?_ reachability problem seeks to identify the set R = {( _?, ?_ ) |
∃ _?_ : _?_ ⇝ _?_ ∈ _?_ | _?_ ( _?_ ) ∈ _?_ }. In static analysis, two prominent instances of this problem are _CFL/Dyck_ _reachability_,
where _?_ is a CFL/Dyck language, and _Interleaved_ _Dyck_
_Reachability_, where _?_ = _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ) is an interleaved
Dyck language. Although CFL/Dyck reachability is solved
in cubic time [2, 22], Interleaved Dyck Reachability is undecidable [15]. As a way to circumvent this undecidability, various techniques focus on tractable (over)approximations of
the reachability set R, i.e., they compute a set Rover ⊇R. Naturally, the goal of each approximation Rover is to minimize
the number of false positives, i.e., the quantity |Rover| −|R|.
3 Baseline approximations
Here we review the standard approximation approaches.
3.1 Regularization
A natural approximation to the problem is _regularization_ .
It relies on the fact that the intersection of a context-free
language and a regular language is a context-free language.
Thus, we can approximate, say, _?_ (Σ _?_ ), through a regular
language _?_ (Σ _?_ ) ⊇ _?_ (Σ _?_ ), and perform standard reachability with the CFL _?_ reg(Σ _?,_ Σ _?_ ) = _?_ (Σ _?_ ) ∩ _?_ (Σ _?_ ).
A standard approach for this is overapproximation via _?_ contexts. The idea is that we keep track of a bounded stack
for _?_ (Σ _?_ ) of ≤ _?_ open brackets, making sure that each is
properly matched when we encounter a close bracket. _?_ (Σ _?_ )
also accepts all strings when the stack exceeds the bound _?_ .
Figure 4 shows a finite state automaton for _?_ (Σ _?_ ) for
_?_ = 1, adapted from [18]. Observe that with _??_ types of
brackets, the size of the automaton is Θ( _??_ <sup>_?_</sup> ), i.e., the automaton grows exponentially quickly in _?_ . For this reason,
practical applications rely on _?_ = 1 or _?_ = 2, to keep the
complexity blowup modest (though it is still considerable).
In our experimental section, we will consider the regularization method with _?_ = 1, which will be labeled as REG .
3.2 Intersection
Another simple and common approach is the _intersection_
_method_, which was recently popularized under the term Synchronized Pushdown Systems [19].
Springer
Fig. 4 (Left) An automaton for _?_ (Σ _?_ ) with _??_ = 3 and _?_ = 1. Unlabeled brackets represent brackets of any label. (Right) A graph with
three paths _?_ 1 : _?_ ⇝ _?_, _?_ 2 : _?_ ⇝ _?_ and _?_ 3 : _?_ ⇝ _?_, whose label is in
_?_ (Σ _?_ )
Fig. 5 There are two paths _?_ 1 _, ?_ 2 : _?_ ⇝ _?_, with _?_ ( _?_ 1 ) =
(1 ]1 [1 )1 ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) and _?_ ( _?_ 2 ) = (2 [2 ]2 )3 ∈ _?_ <sup>′</sup> (Σ _?_ _,_ Σ _?_ ), thus
the intersection algorithm incorrectly returns that _?_ is reachable
from _?_ . On the other hand, there is a path _?_ 3 : _?_ ⇝ _?_ with
_?_ ( _?_ 3 ) = (2 [2 ]2 )2 ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) ∩ _?_ <sup>′</sup> (Σ _?_ _,_ Σ _?_ ), thus the algorithm
correctly identifies that _?_ is reachable from _?_
Consider a string _?_ ∈ _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ), thus _?_ ⇂ Σ _?_ ∈
_?_ (Σ _?_ ). We will construct a new grammar _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) that
ignores characters in Σ _?_ . _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) will be defined similarly to _?_ (Σ _?_ ) (as shown in Sect. 2), with the addition of the
following rule:
∀ _?_ ∈[ _??_ ] _, ?_ ( _??_ ) and _?_ ( _??_ ) _._ (4)
We can construct _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) analogously, with the addition of the following rule to _?_ (Σ _?_ ):
∀ _?_ ∈[ _?_ _?_ ] _, ?_ ( _??_ ) and _?_ ( _~~?~~_ _?_ ) _._ (5)
Observe that _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ) = _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) ∩ _?_ <sup>′</sup> (Σ _?,_
Σ _?_ ). Moreover, each of _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) and _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) is a
CFL, thus the corresponding reachability problem is solvable in cubic time. We can then compute R _?_ (resp., R _?_ )
as the result of _?_ <sup>′</sup> (Σ _?,_ Σ _?_ )-reachability (resp., _?_ <sup>′</sup> (Σ _?,_ Σ _?_ )reachability) on _?_, and we have that Rover = R _?_ ∩R _?_ is
an overapproximation of R, as desired. Notice that computing Rover is not equivalent to solving reachability for
_?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ). This is illustrated in Fig. 5. We refer
to the intersection method with grammars _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) and
_?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) as INT .
3.3 Mutual refinement
The mutual refinement algorithm introduced in [20] builds
upon intersection, and is based on the following observation. Let again R _?_ (resp., R _?_ ) be the result of _?_ <sup>′</sup> (Σ _?,_ Σ _?_ )reachability (resp., _?_ <sup>′</sup> (Σ _?,_ Σ _?_ )-reachability), and assume
Springer
Fig. 6 Executing the mutual
refinement algorithm on the
graph of Fig. 5. Dashed (resp.,
dotted) lines represent the edges
in some path exclusively in
_?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) (resp.,
_?_ <sup>′</sup> (Σ _?_ _,_ Σ _?_ )), while solid lines
represent edges in both. Node _?_
is no longer incorrectly
identified as reachable from _?_,
as edges from paths _?_ 1 and _?_ 2
have been removed. Node _?_ is
still identified as reachable from
_?_, as _?_ 3 has been kept intact
that for two nodes _?_, _?_, we have ( _?, ?_ ) ∈R _?_ ∩R _?_ . If the
set of paths witnessing ( _?, ?_ ) ∈R _?_ is disjoint from the set
of paths witnessing ( _?, ?_ ) ∈R _?_, then we can conclude that
( _?, ?_ ) ∉ R. The mutual-refinement algorithm exploits this
insight in a recursive way, as follows (see Fig. 6):
(1) Compute R _?_ and identify the set of edges _?_ <sup>′</sup> ⊆ _?_ that are
contained in some path _?_ such that _?_ ( _?_ ) ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ).
This can be done through a simple modification of the
standard CFL-reachability algorithm.
(2) Analogously, compute R _?_ and identify the set of edges
_?_ <sup>′′</sup> ⊆ _?_, formed by the edges that participate in some
path _?_ such that _?_ ( _?_ ) ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ).
(3) If _?_ <sup>′</sup> ∩ _?_ <sup>′′</sup> = _?_, halt and return R _?_ ∩R _?_ . Otherwise, let
_?_ = ( _?, ?_ <sup>′</sup> ∩ _?_ <sup>′′</sup> _,_ Σ _?_ ∪ Σ _?_ ) and return to Item (1).
Since an edge must be removed at any repetition of Item
(1), the algorithm converges. In fact, in real world instances
this algorithm is shown to converge quickly. The mutual refinement methods with grammars R _?_ and R _?_ will be labeled
as MR .
4 Our approach
Our approach extends the mutual-refinement algorithm in
three distinct directions. First, we introduce new grammars
for each refinement step: instead of working with the language _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) (i.e., the one that faithfully captures the
parentheses in Σ _?_ but completely ignores the brackets in Σ _?_ ),
we introduce a new language that simultaneously performs a
simple regular approximation of the brackets.
Second, we investigate instances where selectively erasing
information may help identify unreachable pairs. Generally,
this is because additional characters or labels may add noise
to paths between pairs that would be otherwise provably
unreachable. Although these methods are not particularly
precise by themselves, they can be coupled with other techniques to improve analyses.
Fig. 7 There are paths _?_ 1 _, ?_ 2 : _?_ ⇝ _?_ with _?_ ( _?_ 1 ) = (1 [1 )1 ∈
_?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) and _?_ ( _?_ 2 ) = [2 (2 ]2 ∈ _?_ <sup>′</sup> (Σ _?_ _,_ Σ _?_ ). Both paths are retained after mutual refinement, as they contribute to the reachability
_?_ ⇝ _?_ and _?_ ⇝ _ℎ_ . Hence, the algorithm incorrectly concludes that _?_
reaches _?_ . However, neither of _?_ ( _?_ 1 ), _?_ ( _?_ 2 ) is in _?_ par (Σ _?,_ Σ _?_ ) or
_?_ par (Σ _?_ _,_ Σ _?_ )
Third, we run the resulting algorithm in an on-demand
way (i.e., for computing reachability between a given pair of
nodes), which effectively reduces imprecision by removing
parts of the graph that are provably not relevant for the query
at hand.
We follow these methods with a short discussion on how
to combine them in one single analysis.
4.1 Stronger grammars
We focus on extensions of _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) (as defined in
Sect. 3.2), as those for _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ) are analogous. The focus
is on adding only a constant amount of rules to _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ),
and discarding cases of unreachable pairs of nodes that the
usual mutual refinement algorithm does not recognize as
unreachable.
Parity conditions Observe that for any _?_ ∈ _?_ (Σ _?_ ), we
have that | _?_ | is even, as every opening bracket is matched
to a unique closing bracket. We can thus extend _?_ <sup>′</sup> (Σ _?,_ Σ _?_ )
to _?_ par (Σ _?,_ Σ _?_ ), the latter being identical to the former but
excluding strings for which the number of brackets is odd.
This is achieved by the following CFG, where _?_ 0 is the
start symbol (see Fig. 7 for an illustration). Intuitively, _?_ _?_
recognizes strings where the number of brackets has parity _?_ :
_?_ 0( _?_ ) _,_ (6)
∀ _?_ ∈[ _?_ _?_ ] _, ?_ ∈{0 _,_ 1} _, ?_ _?_ ( _???_ _~~?~~_ _?_ ) ← _?_ _?_ ( _?_ ) _,_ (7)
∀ _?_ ∈[ _??_ ] _, ?_ 1 ( _??_ ) and _?_ 1( _??_ ) _._ (8)
We also update the concatenation rule. For all _?_ 1 _, ?_ 2 ∈
{0 _,_ 1},
_?_ _?_ 1 ⊕ _?_ 2 ( _?_ 1 _?_ 2) ← _?_ _?_ 1 ( _?_ 1) _, ?_ _?_ 2 ( _?_ 2) _,_ (9)
where ⊕ represents “exclusive or.” In words, _?_ 1 and _?_ 2 represent the parity of the number of brackets in the strings _?_ 1
and _?_ 2. The concatenation of _?_ 1 and _?_ 2 results in the string
_?_ 1 _?_ 2, which contains a number of bracket characters of parity
_?_ 1 ⊕ _?_ 2.
We use PAR to refer to the mutual refinement method
using the grammars _?_ par (Σ _?,_ Σ _?_ ) and _?_ par (Σ _?,_ Σ _?_ ).
Extended parity conditions The above parity condition
extends naturally: for any string _?_ ∈ _?_ (Σ _?_ ), not only is | _?_ |
even, but the number of characters of any particular label
type is also even. Unfortunately, keeping track of the parity
of every single label type increases the grammar size exponentially. To circumvent this, we choose a small number
_?_, and arbitrarily partition the bracket labels into _?_ groups.
Now, we require that the number of characters in each group
is even. We thus arrive at the language _?_ par _?_ (Σ _?,_ Σ _?_ ), parameterized by _?_ .
More precisely, we fix some constant _?_ and arbitrarily define some function _?_ : [ _??_ ] →[ _?_ ]. This defines the _?_ groups
for the bracket labels. We then define _?_ : [ _?_ ] →{0 _,_ 1}. Now,
_?_ _?_ contains some string _?_ if and only if _?_ ⇂ Σ _?_ ∈ _?_ (Σ _?_ ) and
In words, the parity of the number of characters in each
group _?_ must match _?_ ( _?_ ). The rules will be generalizations
of the rules for the single parity condition. For all _?_ : [ _?_ ] →
{0 _,_ 1}, _?_ _?_ will be the smallest set that conforms to the stated
rules.
Let _?_ 0 be such that ∀ _?_ ∈[ _?_ ], _?_ 0( _?_ ) = 0. We have
_?_ _?_ 0 ( _?_ ) _._ (10)
Also, for every set _?_ : [ _?_ ] →{0 _,_ 1} and every _?_ ∈[ _?_ _?_ ],
_?_ _?_ ( _???_ _~~?~~_ _?_ ) ← _?_ _?_ ( _?_ ) _._ (11)
We now define, ∀ _?_ ∈[ _?_ ], a set _??_ that is such that _??_ ( _?_ ) = 1
and _??_ ( _?_ ) = 0 for all _?_ ≠ _?_ . For each of these _??_ and every
_?_ ∈[ _??_ ]| _?_ ( _?_ ) = _?_,
_?_ _??_ ( _?_ _?_ ) _,_ (12)
_?_ _??_ ( _?_ _?_ ) _._ (13)
Finally, let _?_ <sup>′</sup> ⊕ _?_ <sup>′′</sup> be such that ( _?_ <sup>′</sup> ⊕ _?_ <sup>′′</sup> )( _?_ ) = _?_ <sup>′</sup> ( _?_ ) ⊕
_?_ <sup>′′</sup> ( _?_ ). For all _?_ <sup>′</sup> _,_ _?_ <sup>′′</sup> : [ _?_ ] →{0 _,_ 1},
_?_ _?_ <sup>′</sup> ⊕ _?_ <sup>′′</sup> ( _?_ 1 _?_ 2) ← _?_ _?_ <sup>′</sup> ( _?_ 1) _, ?_ _?_ <sup>′′</sup> ( _?_ 2) _._ (14)
The language _?_ par _?_ (Σ _?,_ Σ _?_ ) will consist of the strings
contained in _?_ _?_ 0 ; _?_ par _?_ (Σ _?,_ Σ _?_ ) is defined analogously. Notice that _?_ par _?_ (Σ _?,_ Σ _?_ ) = _?_ par (Σ _?,_ Σ _?_ ) when _?_ = 1.
We use PARk to refer to the mutual refinement method
using the grammars _?_ par _?_ (Σ _?,_ Σ _?_ ) and _?_ par _?_ (Σ _?,_ Σ _?_ ). For
example, for _?_ = 2, we label the method as PAR2 .
Valid endpoints Recall that the regularization method
(Sect. 3.1) makes an explicit representation of the stack of
size up to _?_ . Unfortunately, this blows up the grammar size
Springer
_?_ | _?_ ( _?_ )= _?_
∀ _?_ ∈[ _?_ ] _,_
_?_ ⇂
������
{ _?_ _?_ _, ?_ _?_ }
≡ _?_ ( _?_ ) mod 2 _._
������
Fig. 8 A finite-state automaton for _?_ <sup>′</sup> (Σ _?_ ). The unlabeled brackets
are used as shorthand for a bracket of any label
Fig. 9 There are two paths _?_ 1 _, ?_ 2 : _?_ ⇝ _?_ with _?_ ( _?_ 1 ) =)1 (1 and
_?_ ( _?_ 2 ) =]1 [1. Mutual refinement does not remove any of their edges,
as they are contained in valid paths _?_ ⇝ _?_ and _?_ ⇝ _ℎ_, respectively. We have _?_ ( _?_ 1 ) ∈ _?_ par (Σ _?_ _,_ Σ _?_ ) and _?_ ( _?_ 2 ) ∈ _?_ par (Σ _?,_ Σ _?_ ),
thus _?_ is incorrectly deemed reachable from _?_ . Notice, though, that
)1 (1∉ _?_ <sup>′</sup> (Σ _?_ ) and ]1 [1∉ _?_ <sup>′</sup> (Σ _?_ ), thus _?_ ( _?_ 1 ) ∉ _?_ par <sup>+</sup> <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>and</sup>
_?_ ( _?_ 2 ) ∉ _?_ par <sup>+</sup> <sup>_?_</sup> <sup>(Σ</sup> <sup>_?_</sup> <sup>_,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>),</sup> <sup>correctly</sup> <sup>concluding</sup> <sup>that</sup> <sup>_?_</sup> <sup>is</sup> <sup>not</sup> <sup>reachable</sup>
from _?_
significantly: even for _?_ = 1, the grammar increases by a factor _??_ . Here we introduce a simpler but effective condition.
We use a regular language _<u>?</u>_ <sup>′</sup> (Σ _?_ ) that recognizes strings that
start with _??_ and end with _?_ _?_, for some _?, ?_ ∈[ _??_ ], expressed
by the automaton in Fig. 8.
The choice of this language is twofold: this condition discards unreachable pairs that none of the previous approaches
do, as shown in Fig. 9, while it is succinctly expressible.
Combining these with the extended parity conditions, and
generating _?_ par _?_ (Σ _?,_ Σ _?_ ) and _?_ <sup>′</sup> (Σ _?_ ) analogously, our new
languages for the mutual refinement algorithm are as follows:
_?_ <sup>+</sup> (15)
par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>) =</sup> <sup>_?_</sup> <sup>par</sup> <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>) ∩</sup> <sup>_?_</sup> <sup>′</sup> <sup>(Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>_,_</sup>
_?_ <sup>+</sup> (16)
par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>) =</sup> <sup>_?_</sup> <sup>par</sup> <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>) ∩</sup> <sup>_?_</sup> <sup>′</sup> <sup>(Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>_._</sup>
The version of PARk extended to accommodate this
“valid endpoints” condition will be labeled PARkE . For
_?_ = 2, this label is PAR2E .
4.2 Erasing characters or labels
In Sect. 4.1, we sought to identify simple properties that
prove some string is not in _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ), and then adapt
CFLs to incorporate these properties. A problem with this
approach is that adding noise may obfuscate the analysis.
For example, consider the following property: if a string
starts with ] _?_, then it is not in _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ). By this property, we conclude that _?_ =]2(1)1 [2 [2]2 ∉ _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ).
Suppose we now enclose _?_ in brackets, to generate _?_ <sup>′</sup> =
[3]2 (1)1 [2 [2]2]3. We can no longer use this criterion to discard _?_ <sup>′</sup> .
By choosing to strategically ignore certain information,
for example, erasing all characters of form [3 or ]3, we may
expose the unreachability between certain pairs while keeping the analysis sound.
Springer
Fig. 10 In the example above, all paths _?_ : _?_ ⇝ _?_ contain either
more symbols (1 than )1 or more symbols [1 than ]1, thus _?_ does not
reach _?_ . This can be captured by analyzing the unlabeled variant of each
edge, so all paths _?_ : _?_ ⇝ _?_ are such that the formed unlabeled string
_?_ <sup>′</sup> ( _?_ ) = (((()), which is not well nested. This unreachability is not
captured by any of the previous grammars, as they would necessarily
disregard needed information about one of the two types of symbols
(parenthesis or brackets)
It is worth noting that, usually, ignoring information will
indeed only produce more false positives. This is not a problem if we use this method alongside previous ones, in which
case the potentially reachable pairs will be an intersection of
pairs not discarded by any of the used approaches (edges in
the mutual refinement loop may also be discarded by any of
the methods).
We show two ways in which the graph can be simplified
and examples that show these simplifications may help remove reachable pairs that would otherwise be misreported.
These methods show how to simplify graph information.
Projection to an unlabeled Dyck grammar Let Σ _?_ =
{ _?,_ _~~?~~_ }, with ( and ) being used in examples. We call _?_ (Σ _?_ )
the _unlabeled_ Dyck grammar.
We can transform _?_ ∈ _?_ (Σ _?_ ) into a string _?_ <sup>′</sup> ∈ _?_ (Σ _?_ ) by
removing the labels from each of the characters. For example,
if _?_ = (1 (2)2)1 (3)3 then _?_ <sup>′</sup> = (())().
Consider now a string _?_ ∈ _?_ (Σ _?_ ) ⊙ _?_ (Σ _?_ ). We can also
transform _?_ into a string _?_ <sup>′</sup> ∈ _?_ (Σ _?_ ) by removing the labels
from each of the characters. In this case, characters ( _?_ or [ _?_ for
some _?_ will be replaced by ( and characters ) _?_ or ] _?_ for some
_?_ will be replaced by ). Notice that we also do not distinguish
parenthesis and brackets. For example, if _?_ = (1 [1)1]1 [2]2 (3)3
then _?_ <sup>′</sup> = (())()(). Notice how _?_ <sup>′</sup> ∈ _?_ (Σ _?_ ), even though the
matching parenthesis (or brackets) may not be the same pairs
of characters as in _?_ .
This property follows immediately from the pushdown
automata formulation of Dyck languages, where opening
characters are interpreted as pushing elements into a stack
and closing characters are interpreted as popping the corresponding element.
This projection allows us to keep track of the number of
both open parenthesis and brackets, although we lose the
ability of distinguishing between them. See Fig. 10 for an
illustration. This method can be helpful in removing pairs
where the unreachability comes from particular interactions
between parenthesis and bracket labels, which is not captured
in any of the previous methods.
After simplifying the graph through this transformation,
we can run a simple CFL reachability algorithm for _?_ (Σ _?_ )
Fig. 11 Consider the above variant of the example in Fig. 9. The
paths _?_ 1 _, ?_ 2 : _?_ ⇝ _?_ are now such that _?_ ( _?_ 1 ) = (2 [2 )1 (1 ]2 )2 and
_?_ ( _?_ 2 ) = (2 [2 ]1 [1 ]2 )2. As a consequence, they now meet the “valid
endpoints” condition. Suppose, then, we substitute the edges labeled
with [2 or ]2 (dashed) by unlabeled edges, effectively erasing these
characters. Now, the paths will fail the “valid endpoints” condition for
brackets, and thus be discarded
to look for additional unreachable pairs. If an edge is not
used, as in mutual refinement, the corresponding edge can
also be erased from the original graph. This may be useful
to filter paths for any other analyses being ran alongside this
unlabeled projection approach.
We use PARUnl to refer to the mutual refinement
method using _?_ (Σ _?_ )-reachability on the unlabeled variant
of the graph as defined in this section, alongside grammars
_?_ par (Σ _?,_ Σ _?_ ) and _?_ par (Σ _?,_ Σ _?_ ) in the original graph.
Erasing labels Consider a string _?_ = [1 [2]2]1 [2]2 [3]3 ∈
_?_ (Σ _?_ ). If we erase all characters with a certain label, in this
case, 2, we can generate a new string _?_ <sup>′</sup> = [1]1 [3]3. Notice
that it is always true that _?_ <sup>′</sup> ∈ _?_ (Σ _?_ ).
This can be verified through the derivation of _?_ . If we simply follow the same derivation steps, but “skip” applications
of Rule (2) that introduce the character we intent to erase, we
obtain a valid derivation for _?_ <sup>′</sup> .
In terms of reachability, erasing some label _?_ would be
equivalent to relabeling all edges _?_ from _?_ to _?_ such that
_?_ ( _?_ ) ∈{[ _?,_ ] _?_ } to be such that _?_ ( _?_ ) = _?_ . This transformation
is sound, i.e., every previously reachable pair remains reachable.
Erasing certain characters may expose properties of unreachable pairs that were previously obfuscated, as shown in
Fig. 11.
Notice that this is not simply a grammar that can be added
to the refinement loop. An algorithm that wants to avoid
cases such as in Fig. 11 would have to iterate through bracket
(or parenthesis) labels, and in each step apply some mutual
refinement algorithm over the modified graph. If an edge is
removed in the mutual refinement loop over the modified
graph, it can also be erased from the original graph, whether
the label has been changed or not. We can then compute the
intersection of all potentially reachable pairs.
The mutual refinement method using the grammars
_?_ par (Σ _?,_ Σ _?_ ) and _?_ par (Σ _?,_ Σ _?_ ) that iterates through the
modified graphs eliminating labels corresponding to each
bracket label, as defined above, alongside the same grammars in the original graph will be referred to as PARErase .
4.3 On-demand analysis
Up until now we have sought to approximate the whole set
of reachable node pairs R. A natural question is whether
we can increase the precision by focusing on the on-demand
question, i.e., we ask whether some fixed node _?_ is reachable
from some fixed node _?_ .
We tackle this problem by a small modification to the
mutual refinement algorithm. In Item (1), _?_ <sup>′</sup> ⊆ _?_ is defined
as the set of edges that are contained in some path _?_ such
that _?_ ( _?_ ) ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ). We now, instead, consider only the
edges that are contained in some path _?_ : _?_ ⇝ _?_ for which
_?_ ( _?_ ) ∈ _?_ <sup>′</sup> (Σ _?,_ Σ _?_ ). Similarly for Item (2). This avoids many
cases where the original algorithm fails to discard reachability, like the reachability _?_ ⇝ _?_ in Fig. 7 and from _?_ ⇝ _?_
in Fig. 9. To solve the reachability problem for all pairs of
nodes, we repeatedly solve the on-demand problem. Though
this is generally slower, it leads to increased precision.
We use PARD to refer to the mutual refinement method
using the grammars _?_ par (Σ _?,_ Σ _?_ ) and _?_ par (Σ _?,_ Σ _?_ ) executed on-demand for each potentially reachable pair.
4.4 Combined methods
It is worth pointing out that the previously defined methods
can be freely combined for a more precise analysis.
- Any amount of grammars can be combined and intersected
in the mutual refinement loop, each individually being used
to exclude some set of unused edges. Since the removed
edges from one method may also affect the reachable pairs
in another method, combining grammars in the refinement
loop may eliminate pairs not eliminated by any of them
individually.
- More complex grammars (such as those defined in
Sect. 4.1) can be run in the simplified versions of the graph
(defined in Sect. 4.2), to help eliminate unused edges in
the mutual refinement loop.
- Any of the previously combined version can be run ondemand, as that only affects how the eliminated edges are
selected.
We thus define two combined methods that will be used
in the experimental section.
COM refers to the mutual refinement method using the
grammars _?_ <sup>+</sup> par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>and</sup> <sup>_?_</sup> <sup>+</sup> par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>which</sup> <sup>also</sup> <sup>it-</sup>
grammars _?_ <sup>+</sup> par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>and</sup> <sup>_?_</sup> <sup>+</sup> par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>which</sup> <sup>also</sup> <sup>it-</sup>
erates through the modified graph eliminating labels corresponding to each bracket label and the modified graphs
eliminating labels corresponding to each bracket label, as
these were defined in Sect. 4.2.
COMD refers to a variant of COM that is run on-demand
for each potentially reachable pair.
Springer
<sup>+</sup> par <sup>_?_</sup> <sup>(Σ</sup> <sup>_?,_</sup> <sup>Σ</sup> <sup>_?_</sup> <sup>)</sup> <sup>and</sup> <sup>_?_</sup> <sup>+</sup>
5 Experiments
Here we report on the implementation and experimental evaluation of our approach for approximating Interleaved Dyck
Reachability <sup>1</sup> (Sect. 4), and compare it to previous methods
(Sect. 3). We considered two widely-used analyses from the
literature: a taint analysis for Android [7] and a value-flow
analysis for LLVM [14].
We will analyze the accuracy and runtime of each of our
general approaches, divided in more specific methods for
each approach, followed by a short discussion of the results.
Then we show our final method (combining all of the ones
presented), and discuss how the number of reachable pairs
found compare to previous techniques.
Underapproximation Since we cannot compare our results to the unknown value |R|, we use a simple, standard _underapproximation_ of R instead: the paths identified
by the CFL-reachability algorithm applied to the language
_?_ (Σ _?_ ∪ Σ _?_ ). This identifies every pair of nodes of which
there is a path whose label is properly-balanced in parenthesis and brackets, without any interleaving. For example,
(1 [1]1)1 ∈ _?_ (Σ _?_ ∪ Σ _?_ ) but (1 [1)1]1 ∉ _?_ (Σ _?_ ∪ Σ _?_ ). We call
this set of reachable pairs Runder.
Setup and implementation Taint analysis is modeled
through a data-dependence graph with parentheses modeling
context sensitivity and brackets modeling field sensitivity.
The task is to identify all pairs of variables ( _?, ?_ ) _,?_ ≠ _?_ such
that the value of _?_ flows into _?_ . See [7] for details.
Value-flow analysisismodeled through a data-dependence
graph with parenthesis modeling context sensitivity and
brackets modeling memory stores/loads (in this case _??_ = 1,
i.e., there is only one type of bracket). We seek to identify all
pairs of variables ( _?, ?_ ) _,?_ ≠ _?_ such that the value of _?_ flows
into _?_ . Furthermore, we only consider paths of which the
first edge _?_ _?_ is such that _?_ ( _?_ _?_ ) = [1 and the last edge _?ℓ_ is
such that _?_ ( _?_ _?_ ) = ]1 [7]. This is done in regularization by incorporating this condition in the automaton and in the other
methods by taking into account an additional grammar that
identifies strings _?_ = [1 _?_ <sup>′</sup> ]1 for some string _?_ <sup>′</sup> ∈(Σ _?_ ∪ Σ _?_ ) <sup>∗</sup> .
See [14] for details.
Our benchmark graphs were taken from [20]. For the
taint analysis benchmark we selected all graphs with ≤ 1800
nodes, for a total of 11 benchmarks. For the value-flow analysis, we selected all graphs with ≤ 10 <sup>5</sup> nodes, for a total of 8
benchmarks. These were selected so none of the algorithms
would timeout. We implemented all the methods in Go, and
executed them on a MacBook Air with an Apple M1 chip
and 8 GB of RAM. We set a timeout of one hour for each
algorithm and each benchmark.
1 [github.com/kobusgiovanna/cfl-idr](http://github.com/kobusgiovanna/cfl-idr)
Springer
Table 1 The size of the selected taint benchmarks: | _?_ | and | _?_ | represent the number of nodes and edges, respectively; _??_ and _??_ represent
the number of parenthesis and bracket labels present in the graph
Benchmark | _?_ | | _?_ | _??_ _??_
backflash 544 2048 455 6
batterydoc 1674 4790 1132 87
droidkongfu 734 1983 367 39
fakebanker 434 1103 209 25
fakedaum 1144 2603 715 42
faketaobao 222 450 114 10
jollyserv 488 998 236 28
loozfon 152 323 78 3
roidsec 553 2026 362 13
uranai 568 1246 357 8
zertsecurity 281 710 166 9
For the value-flow benchmark, both Mutual Refinement
and our method obtained a tight result, as we had Rover =
Runder, for all but one benchmark (povray), in which Mutual Refinement overreported one path, which our method
discarded. This means that this benchmark set is not particularly challenging (though, to our knowledge, this tightness
had not been observed before). We will therefore focus a detailed report on the methods in the taint analysis benchmarks.
Data on the selected taint analysis benchmarks is shown
in Table 1.
5.1 Stronger grammar
Here we compare the methods PAR, PAR2, and PAR2E, as
they were defined in Sect. 4.1. Notice that each method is
strictly stronger than the previous.
Table 2 shows the number of reachable pairs found and
total runtime for each method. Both extending the parity
condition and verifying endpoint incur a significant runtime
cost, although the second offer a much bigger increase in
accuracy.
5.2 Erasing characters or labels
We compare grammars PAR, PARUnl, and PARErase . We
take the parity method as a reference, then add to it the two
proposed methods from Sect. 4.2. We may now justify the
choice of iterating through the bracket labels for PARErase .
As shown in Table 1, these are significantly less numerous
then the parenthesis labels, which impacts runtime.
Table 3 shows the number of reachable pairs found and total runtime for each method. The simplification-based methods indeed capture more unreachable pairs when compared
with the simple parity grammar.
Table 2 Experimental results for the grammar-based methods in the
taint analysis benchmark. We compare the grammars presented in
Sect. 4.1 and report the number of potentially reachable pairs found
and total runtime for each method
Benchmark PAR PAR2 PAR2E
backflash 2754 2754 2625
batterydoc 4661 4658 3666
droidkongfu 5273 5240 4983
fakebanker 590 590 279
fakedaum 2826 2805 2545
faketaobao 151 151 64
jollyserv 176 175 164
loozfon 212 211 93
roidsec 16,362 16,361 13,586
uranai 143 143 143
zertsecurity 1081 1045 883
Total 34,229 34,133 29,031
Total −|Runder | 11,019 10,923 5821
Runtime (s) 89 462 6536
Table 3 Experimental results for the grammar-based methods in the
taint analysis benchmark. We compare the parity condition PAR from
Sect. 4.1, the added conditions from Sect. 4.2 and report the number of
potentially reachable pairs found and total runtime for each method
Benchmark PAR PARUnl PARErase
backflash 2754 2736 2754
batterydoc 4661 4500 4661
droidkongfu 5273 5242 5273
fakebanker 590 354 590
fakedaum 2826 2669 2669
faketaobao 151 59 151
jollyserv 176 174 176
loozfon 212 153 212
roidsec 16,362 15,283 16,362
uranai 143 143 143
zertsecurity 1081 1081 1080
Total 34,229 32,394 34,071
Total −|Runder | 11,019 9184 10,861
Runtime (s) 89 156 7393
The most important property of these methods is that they
can remove pairs not deemed unreachable by any of the previous methods. This can be observed in the “faketaobao”
benchmark, in which method PARUnl performs better than
any of the methods in Table 2. Method PARUnl also, generally, offers a minimal runtime overhead while still significantly improving the overapproximation.
Table 4 Experimental results showing the difference of running the
parity method on-demand. We compare PAR with the on-demand version PARD, as defined in Sect. 4.3. We report the number of potentially
reachable pairs found and total runtime for each method
Benchmark PAR PARD
backflash 2754 2625
batterydoc 4661 3428
droidkongfu 5273 3772
fakebanker 590 254
fakedaum 2826 2320
faketaobao 151 61
jollyserv 176 164
loozfon 212 93
roidsec 16,362 14,214
uranai 143 143
zertsecurity 1081 804
Total 34,229 27,878
Total −|Runder | 11,019 4668
Runtime (s) 89 4264
Method PARErase, on the other hand, is much slower and
not as effective at removing additional unreachable pairs. It
can still remove pairs not removed by previous methods, so
it should be only used when minimizing runtime is not a
priority.
5.3 On-demand analysis
We compare grammars PAR and PARD, defined in Sects. 4.1
and 4.3, to analyze the number of identified potentially reachable pairs when running certain algorithms on-demand versus traditionally. It is worth noting that a few optimization
were used to decrease the on-demand runtime. These mainly
comprise of: not testing provably reachable pairs (through
the underapproximation), compressing mutually reachable
nodes, caching reachability information for subgraphs during mutual refinement, and running more efficient algorithms
first to reduce the number of potentially reachable pairs to be
queried.
Results are shown in Table 4. Notice that even with the
optimizations, running the algorithm on-demand has a heavy
effect on runtime. We believe this technique is better reserved
from when the reachability information of only a few pairs of
vertices is required, as opposed to all potentially reachable
pairs.
We also note the choice of PAR as a baseline, to standardize the comparison with the previous methods. In terms of
on-demand as a standalone method, we note that the original
mutual refinement method MR, when run on-demand, takes
1810 seconds and reports 28,589 reachable pairs, as opposed
to 36,949 pairs when run classically.
Springer
5.4 Combined methods and final comparisons
We now present a more broad comparison of the number of
reachable pairs found by methods previously available in the
literature compared the ones introduced in this paper. We
compare the previous methods REG, INT, and MR, defined
in Sect. 3, with our methods COM and COMD, defined in
Sect. 4.4.
Alongside a table comparing the main methods, we provide a visual representation of the reduction on the number
of pairs not captured by the under or the overapproximation,
i.e., the pairs for which the answer is unknown. This figure
highlights the remarkable reduction in the number of pairs
we do not know the true answer for.
Results The results for the taint analysis benchmark are
shown in Fig. 12. We observe that MR is always more precise
than both REG and INT, which aligns with the conclusions
made in [20].
We thus compare, in Table 5, our methods with MR . We
also add the number of pairs reported in the underapproximation as a reference. Our methods COM and COMD are
always more precise than MR, and often by a large amount.
Overall, the geometric average of |Rover|/|Runder| per benchmark for MR and COMD is 2 _._ 22 and 1 _._ 13, respectively. This
number is 1 _._ 22 if we only consider the not on-demand variant
COM . This means that, on average, Mutual Refinement has
55% potential false positive rate, while our best performing
method has 12% potential false positive rate. We note that
since COMD is guaranteed to be more precise than MR,
all pairs reported by Mutual Refinement but not our method
are indeed false positives. The geometric mean of the overapproximations |Rover <sup>COMD</sup> |/|Rover <sup>MR</sup> <sup>|</sup> <sup>is</sup> <sup>51%, i.e., we report, on</sup>
over <sup>COMD</sup> |/|Rover <sup>MR</sup>
approximations |Rover <sup>COMD</sup> |/|Rover <sup>MR</sup> <sup>|</sup> <sup>is</sup> <sup>51%, i.e., we report, on</sup>
average, about half the reachable pairs compared to the most
recent alternative.
Performance considerations Since the increase in
grammar size is constant, the mutual refinement method
using our stronger grammar is only slower than the original
mutual refinement algorithm by some constant factor.
This work mainly seeks to minimize |Rover| −|Runder|.
More practical applications may consider trade-offs between
runtime and false positive rate. For example, as shown in
Table 2, PAR2 is significantly slower than PAR, while only
increasing accuracy marginally. Running the on-demand algorithm offers a significant runtime penalty for the all-pairs
problem, but is a good approach when only few pairs are
queried. The selection of methods must be considered for
the particular problem, setting, and benchmark size the algorithm will be applied in.
Springer
Fig. 12 Experimental results for the taint analysis. Column numbers
indicate |Rover | −|Runder |. Bar lengths are normalized by the worstperforming method. COM and COMD correspond to our methods
6 Related work
Language reachability, in particular with respect to a CFL,
has been studied extensively in the context of static analyses.
It is known that the problem can be solved in _?_ ( _?_ <sup>3</sup> ) time,
and this bound is believed to admit no polynomial improvements (i.e., no algorithm running in time _?_ ( _?_ <sup>3−</sup> <sup>_?_</sup> ) is possible, for any fixed _?>_ 0, under popular assumptions) [23–25].
Reachability over single-letter alphabets, however, takes es
Table 5 Experimental results for taint analysis. We compare |R _?????_ |
with the three best-performing methods, as defined in Sect. 5.3, which
correspond to _Mutual Refinement_, _Stronger Grammar_ and _On-demand_,
respectively. Total times for _Regularization_ and _Intersection_ were 487
and 49 seconds, respectively
Benchmark |R _under_ | MR COM COMD
backflash 2625 2870 2625 2625
batterydoc 2804 5484 3666 3340
droidkongfu 2906 5442 4983 3393
fakebanker 249 1172 272 251
fakedaum 1132 3243 2545 2280
faketaobao 57 328 59 59
jollyserv 155 303 164 164
loozfon 76 424 93 93
roidsec 12,284 16,425 13,586 13,052
uranai 143 148 143 143
zertsecurity 779 1110 883 794
Total 23,210 36,949 29,019 26,194
Total −|Runder | 0 4668 5819 2984
Runtime (s) 6 56 6504 190,721
sentially matrix-multiplication time [26, 27]. The program
model is also commonly known as Recursive State Machines [22, 28, 29].
Interleaved Dyck Reachability can also be seen as CFL
reachability (noninterleaved) over an RSM. Other recent
approximations to the problem include Linear Conjunctive
Language reachability [18] and computing Parikh images via
Mixed Integer Programming [30].
7 Conclusion
Interleaved Dyck Reachability is a framework used in a
plethora of static analyses, and is successful in achiever high
precision by tracking both context and field-sensitivity. Since
this framework is, in general, undecidable, existing work focuses on approximations.
In this work, we developed a plethora of CFL-based techniques that expanded upon a recent, mutual-refinement approximation. These rely on various techniques and insights
about the Interleaved Dyck Grammar, and on an adaptation of
the previous mutual refinement algorithm to an on-demand
version, that can achieve higher precision.
Because of the incremental nature of our work, the choice
of grammar can be tuned to select among different levels of
efficiency and precision. This also means that this work can
be easily expanded as new grammars are developed. We also
note that our work can be extended to model the interleaving
of more than two Dyck languages, although we leave the
development of the exact grammar and exploration of the
runtime consequences as future work.
We tested our algorithms on real-world benchmarks and
compared them to the most recent alternatives. Our work
reported 51% of the reachable pairs reported by the most recent alternative, confirming that about half of the previously
reported paths were indeed false positives.
We also, for the first time, obtained a bound on the number
of false positives per benchmark, by comparing our results
with an underapproximation. By this metric, our reported
reachable pairs contain, on average, a 12% potential false
positive rate.
Funding information Open access funding provided by Hong Kong
University of Science and Technology. This work was partially supported by a research grant (VIL42117) from VILLUM FONDEN and
a grant from STIBOFONDEN. G.K. Conrado was partially supported
by the Hong Kong PhD Fellowship Scheme (HKPFS).
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long
as you give appropriate credit to the original author(s) and the source,
provide a link to the Creative Commons licence, and indicate if changes
were made. The images or other third party material in this article are
included in the article’s Creative Commons licence, unless indicated
otherwise in a credit line to the material. If material is not included in
the article’s Creative Commons licence and your intended use is not
permitted by statutory regulation or exceeds the permitted use, you will
need to obtain permission directly from the copyright holder. To view a
[copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.](http://creativecommons.org/licenses/by/4.0/)
References
1. Reps, T.: Program analysis via graph reachability. Inf. Softw.
Technol. 40 (11), 701–726 (1998). [https://doi.org/10.1016/S0950-](https://doi.org/10.1016/S0950-5849%0x2898%0x2900093-7)
[5849(98)00093-7](https://doi.org/10.1016/S0950-5849%0x2898%0x2900093-7)
2. Yannakakis, M.: Graph-theoretic methods in database theory. In:
Proceedings of the Ninth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, PODS, pp. 230–242
(1990)
3. Pavlogiannis, A.: CFL/Dyck reachability: an algorithmic perspective. ACM SIGLOG News 9 (4), 5–25 (2022). [https://doi.org/10.](https://doi.org/10.1145/3583660.3583664)
[1145/3583660.3583664](https://doi.org/10.1145/3583660.3583664)
4. Reps, T., Horwitz, S., Sagiv, M.: Precise interprocedural dataflow
analysis via graph reachability. In: POPL. ACM, New York (1995)
5. Reps, T.: Shape analysis as a generalized path problem. In: Proceedings of the 1995 ACM SIGPLAN Symposium on Partial Evaluation
and Semantics-Based Program Manipulation, PEPM’9, pp. 1–11.
[Association for Computing Machinery, New York (1995). https://](https://doi.org/10.1145/215465.215466)
[doi.org/10.1145/215465.215466](https://doi.org/10.1145/215465.215466)
6. Rehof, J., Fähndrich, M.: Type-base flow analysis: from polymorphic subtyping to CFL-reachability. In: Proceedings of the 28th
ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL, pp. 54–66 (2001)
7. Huang, W., Dong, Y., Milanova, A., Dolby, J.: Scalable and precise
taint analysis for Android. In: Proceedings of the 2015 International Symposium on Software Testing and Analysis, ISSTA 2015,
pp. 106–117. Association for Computing Machinery, New York
[(2015). https://doi.org/10.1145/2771783.2771803](https://doi.org/10.1145/2771783.2771803)
Springer
8. Tang, H., Wang, D., Xiong, Y., Zhang, L., Wang, X., Zhang, L.:
Conditional Dyck-cfl reachability analysis for complete and efficient library summarization. In: Yang, H. (ed.) Programming
Languages and Systems, pp. 880–908. Springer, Berlin (2017)
9. Lhoták, O., Hendren, L.: Context-sensitive points-to analysis: is it
worth it? In: Proceedings of the 15th International Conference on
Compiler Construction, CC’06, pp. 47–64. Springer, Berlin (2006).
[https://doi.org/10.1007/11688839_5](https://doi.org/10.1007/11688839_5)
10. Yan, D., Xu, G., Rountev, A.: Demand-driven context-sensitive
alias analysis for Java. In: Proceedings of the 2011 International Symposium on Software Testing and Analysis, ISSTA’11,
pp. 155–165. Association for Computing Machinery, New York
[(2011). https://doi.org/10.1145/2001420.2001440](https://doi.org/10.1145/2001420.2001440)
11. Sridharan, M., Gopan, D., Shan, L., Bodík, R.: Demand-driven
points-to analysis for Java. In: Proceedings of the 20th Annual
ACM SIGPLAN Conference on Object-Oriented Programming,
Systems, Languages, and Applications, OOPSLA’05, pp. 59–76.
[Association for Computing Machinery, New York (2005). https://](https://doi.org/10.1145/1094811.1094817)
[doi.org/10.1145/1094811.1094817](https://doi.org/10.1145/1094811.1094817)
12. Shang, L., Xie, X., Xue, J.: On-demand dynamic summary-based
points-to analysis. In: Proceedings of the Tenth International
Symposium on Code Generation and Optimization, CGO’12,
pp. 264–274. Association for Computing Machinery, New York
[(2012). https://doi.org/10.1145/2259016.2259050](https://doi.org/10.1145/2259016.2259050)
13. Milanova, A.: FlowCFL: generalized type-based reachability analysis: graph reduction and equivalence of CFL-based and typebased reachability. Proc. ACM Program. Lang. 4 (OOPSLA), 1–29
[(2020). https://doi.org/10.1145/3428246](https://doi.org/10.1145/3428246)
14. Sui, Y., Xue, J.: Svf: interprocedural static value-flow analysis in
LLVM. In: Proceedings of the 25th International Conference on
Compiler Construction, CC 2016, pp. 265–266. Association for
[Computing Machinery, New York (2016). https://doi.org/10.1145/](https://doi.org/10.1145/2892208.2892235)
[2892208.2892235](https://doi.org/10.1145/2892208.2892235)
15. Reps, T.: Undecidability of context-sensitive data-dependence
analysis. ACM Trans. Program. Lang. Syst. 22 (1), 162–186 (2000).
[https://doi.org/10.1145/345099.345137](https://doi.org/10.1145/345099.345137)
16. Kjelstrøm, A.H., Pavlogiannis, A.: The decidability and complexity
of interleaved bidirected Dyck reachability. Proc. ACM Program.
Lang. 6 [(POPL) (2022). https://doi.org/10.1145/3498673](https://doi.org/10.1145/3498673)
17. Sridharan, M., Bodík, R.: Refinement-based context-sensitive
points-to analysis for Java. SIGPLAN Not. 41 (6), 387–400 (2006).
[https://doi.org/10.1145/1133255.1134027](https://doi.org/10.1145/1133255.1134027)
18. Zhang, Q., Su, Z.: Context-sensitive data-dependence analysis via
linear conjunctive language reachability. ACM SIGPLAN Not.
52 [(1), 344–358 (2017). https://doi.org/10.1145/3093333.3009848](https://doi.org/10.1145/3093333.3009848)
19. Späth, J., Ali, K., Bodden, E.: Context-, flow-, and field-sensitive
data-flow analysis using synchronized pushdown systems. Proc.
ACM Program. Lang. 3 (POPL) (2019). [https://doi.org/10.1145/](https://doi.org/10.1145/3290361)
[3290361](https://doi.org/10.1145/3290361)
Springer
20. Ding, S., Zhang, Q.: Mutual refinements of context-free language
reachability. In: Static Analysis: 30th International Symposium,
SAS 2023, Cascais, Portugal, October 22–24, 2023, Proceedings,
[pp. 231–258. Springer, Berlin (2023). https://doi.org/10.1007/978-](https://doi.org/10.1007/978-3-031-44245-2_12)
[3-031-44245-2_12](https://doi.org/10.1007/978-3-031-44245-2_12)
21. Conrado, G.K., Pavlogiannis, A.: A better approximation for interleaved Dyck reachability. In: Proceedings of the 13th ACM
SIGPLAN International Workshop on the State of the Art in Program Analysis, SOAP 2024, pp. 18–25. Association for Computing
Machinery, New York (2024). [https://doi.org/10.1145/3652588.](https://doi.org/10.1145/3652588.3663318)
[3663318](https://doi.org/10.1145/3652588.3663318)
22. Chaudhuri, S.: Subcubic algorithms for recursive state machines.
SIGPLAN Not. 43 (1), 159–169 (2008). [https://doi.org/10.1145/](https://doi.org/10.1145/1328897.1328460)
[1328897.1328460](https://doi.org/10.1145/1328897.1328460)
23. Heintze, N., McAllester, D.: On the cubic bottleneck in subtyping
and flow analysis. In: LICS’97, p. 342. IEEE Computer Society,
Washington (1997)
24. Chatterjee, K., Choudhary, B., Pavlogiannis, A.: Optimal Dyck
reachability for data-dependence and alias analysis. Proc. ACM
Program. Lang. 2 (POPL) (2018)
25. Bringmann, K., Grønlund, A., Künnemann, M., Larsen, K.G.:
The NFA acceptance hypothesis: non-combinatorial and dynamic lower bounds. In: LIPIcs, Volume 287, ITCS 2024,
vol. 287, pp. 22–12225 (2024). [https://doi.org/10.4230/LIPICS.](https://doi.org/10.4230/LIPICS.ITCS.2024.22)
[ITCS.2024.22](https://doi.org/10.4230/LIPICS.ITCS.2024.22)
26. Mathiasen, A.A., Pavlogiannis, A.: The fine-grained and parallel
complexity of Andersen’s pointer analysis. Proc. ACM Program.
Lang. 5 [(POPL) (2021). https://doi.org/10.1145/3434315](https://doi.org/10.1145/3434315)
27. Cetti Hansen, J., Husted Kjelstrøm, A., Pavlogiannis, A.: Tight
bounds for reachability problems on one-counter and pushdown
systems. Inf. Process. Lett. 171 [, 106135 (2021). https://doi.org/10.](https://doi.org/10.1016/j.ipl.2021.106135)
[1016/j.ipl.2021.106135](https://doi.org/10.1016/j.ipl.2021.106135)
28. Alur, R., Benedikt, M., Etessami, K., Godefroid, P., Reps, T.W.,
Yannakakis, M.: Analysis of recursive state machines. ACM Trans.
Program. Lang. Syst. (2005)
29. Chatterjee, K., Ibsen-Jensen, R., Pavlogiannis, A., Goyal, P.: Faster
algorithms for algebraic path properties in recursive state machines
with constant treewidth. In: Proceedings of the 42nd Annual ACM
SIGPLAN-SIGACT Symposium on Principles of Programming
[Languages, pp. 97–109. ACM, Mumbai (2015). https://doi.org/10.](https://doi.org/10.1145/2676726.2676979)
[1145/2676726.2676979](https://doi.org/10.1145/2676726.2676979)
30. Li, Y., Zhang, Q., Reps, T.: Single-source-single-target interleavedDyck reachability via integer linear programming. Proc. ACM Program. Lang. 7 [(POPL) (2023). https://doi.org/10.1145/3571228](https://doi.org/10.1145/3571228)
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
섹션 본문
섹션 본문이 없습니다.
참고문헌 27건
- Context-Sensitive Points-to Analysis: Is It Worth It? Lecture notes in computer science · Springer Science+Business Media · 2006 10.1007/11688839_5
- Shape analysis as a generalized path problem 1995 10.1145/215465.215466
- Undecidability of context-sensitive data-dependence analysis ACM Transactions on Programming Languages and Systems · Association for Computing Machinery · 2000 10.1145/345099.345137
- Graph-theoretic methods in database theory 1990 10.1145/298514.298576
- Faster Algorithms for Algebraic Path Properties in Recursive State Machines with Constant Treewidth 2014 10.1145/2676726.2676979
- Program analysis via graph reachability Information and Software Technology · Elsevier BV · 1998 10.1016/s0950-5849(98)00093-7
- Scalable and precise taint analysis for Android 2015 10.1145/2771783.2771803
- Demand-driven points-to analysis for Java 2005 10.1145/1094811.1094817
- On-demand dynamic summary-based points-to analysis 2012 10.1145/2259016.2259050
- Refinement-based context-sensitive points-to analysis for Java ACM SIGPLAN Notices · Association for Computing Machinery · 2006 10.1145/1133255.1134027
- Analysis of recursive state machines ACM Transactions on Programming Languages and Systems · Association for Computing Machinery · 2005 10.1145/1075382.1075387
- Demand-driven context-sensitive alias analysis for Java 2011 10.1145/2001420.2001440
- SVF: interprocedural static value-flow analysis in LLVM 2016 10.1145/2892208.2892235
- Conditional Dyck-CFL Reachability Analysis for Complete and Efficient Library Summarization Lecture notes in computer science · Springer Science+Business Media · 2017 10.1007/978-3-662-54434-1_33
- Optimal Dyck reachability for data-dependence and alias analysis Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2017 10.1145/3158118
- Context-, flow-, and field-sensitive data-flow analysis using synchronized Pushdown systems Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2019 10.1145/3290361
- Context-sensitive data-dependence analysis via linear conjunctive language reachability ACM SIGPLAN Notices · Association for Computing Machinery · 2017 10.1145/3093333.3009848
- FlowCFL: generalized type-based reachability analysis: graph reduction and equivalence of CFL-based and type-based reachability Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2020 10.1145/3428246
- The fine-grained and parallel complexity of andersen’s pointer analysis Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2021 10.1145/3434315
- Subcubic algorithms for recursive state machines ACM SIGPLAN Notices · Association for Computing Machinery · 2008 10.1145/1328897.1328460
- Tight bounds for reachability problems on one-counter and pushdown systems Information Processing Letters · Elsevier BV · 2021 10.1016/j.ipl.2021.106135
- The decidability and complexity of interleaved bidirected Dyck reachability Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2022 10.1145/3498673
- Proceedings of the 18th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '91 1991 10.1145/99583
- Single-Source-Single-Target Interleaved-Dyck Reachability via Integer Linear Programming Proceedings of the ACM on Programming Languages · Association for Computing Machinery · 2023 10.1145/3571228
- CFL/Dyck Reachability ACM SIGLOG News · Association for Computing Machinery · 2022 10.1145/3583660.3583664
- Mutual Refinements of Context-Free Language Reachability Lecture notes in computer science · Springer Science+Business Media · 2023 10.1007/978-3-031-44245-2_12
- A Better Approximation for Interleaved Dyck Reachability 2024 10.1145/3652588.3663318