1 / 27

Towards Abstraction Refinement in TVLA

Towards Abstraction Refinement in TVLA. Alexey Loginov UW Madison alexey@cs.wisc.edu. Need for Heap Data Analysis. Morning talks by UW students Static analyses for de-obfuscation of code Limited ability to analyze heap data Need understanding of possible shapes

Télécharger la présentation

Towards Abstraction Refinement in TVLA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Towards Abstraction Refinement in TVLA Alexey Loginov UW Madison alexey@cs.wisc.edu

  2. Need for Heap Data Analysis • Morning talks by UW students • Static analyses for de-obfuscation of code • Limited ability to analyze heap data • Need understanding of possible shapes • Want to handle unbounded heap object creation • Java objects (e.g. threads) are in heap alexey@cs.wisc.edu

  3. x … y x y Linked List Abstractions • Informally • Formally alexey@cs.wisc.edu

  4. t … … x … … y t’ t x y t’ Linked List Abstractions • Informally • Formally alexey@cs.wisc.edu

  5. x … y x rx rx … y ry ry Linked List Abstractions • Informally • Formally alexey@cs.wisc.edu

  6. t … … x … … y t’ t rx,rt x ry,rt rx rx ry,rt’ ry,rt’ y ry ry t’ Linked List Abstractions • Informally • Formally alexey@cs.wisc.edu

  7. Abstraction Refinement • Devising good analysis abstractions is hard • Precision/cost tradeoff • Too coarse: “Unknown” answer • Too refined: high space/time cost • Start with simple (and cheap) abstraction • Successively refine abstraction • Adaptive algorithm alexey@cs.wisc.edu

  8. Abstraction Refinement • Iterative process • Create an abstraction (e.g. set of predicates) • Run analysis • Detect indefinite answers (stop if none) • Refine abstraction (e.g. add predicates) • Repeat above steps alexey@cs.wisc.edu

  9. Previous Work on Abstraction Refinement • Counterexample guided [Clarke et al] • Finds shortest invalid prefix of spurious counterexample • Splits last state on prefix into less abstract ones • SLAM toolkit [Ball, Rajamani] • Temporal safety properties of software • Identifies correlated branches alexey@cs.wisc.edu

  10. Abstraction Refinement for TVLA:New Challenges • Need to refine abstractions of linked data structures • Identify appropriate new distinctions between • Nodes • Structures • Need to derive the associated abstract interpretation • What are the update formulas? alexey@cs.wisc.edu

  11. y y x x rx ry rx ry Control Over the Merging of Nodes • Unary abstraction predicates rx(v) = v’ : (x(v’)  n*(v’,v)) • Distinguish nodes reachable from x (and y) • Can now tell if lists are disjoint alexey@cs.wisc.edu

  12. x y x y empty structure Control Over the Merging of Structures • Nullary abstraction predicates nnx() = v : x(v) • Distinguish structures based on whether x is NULL • Can now tell that x is NULL whenever y is (and vice versa) alexey@cs.wisc.edu

  13. rx = ½ rx Need for Update Formulas • Re-evaluating formula is imprecise rx(v) = v’ : (x(v’)  n*(v’,v)) Action “x == NULL” (no change to heap) x x rx rx alexey@cs.wisc.edu

  14. Creating Update Formulas Automatically • Frees user from having to provide update formulas • A lot of work (esp. with iterative refinement) • Error prone • Idea: Finite differencing of formulas F() = p  alexey@cs.wisc.edu

  15. Differencing  Differentiation c’ = 0 (f+g)’(x) = f’(x)+g’(x) (f*g)’(x) = f’(x)*g(x) + f(x)*g’(x) 0 = 0 1= 0 () =  () =      alexey@cs.wisc.edu

  16. Laws for  0 = 0 1= 0 (v = w) = 0 () =  () =    (v:) = (v:)  (v:) (TC:)(v,w) = (TC:)(v,w)  (TC:)(v,w) alexey@cs.wisc.edu

  17. x rx rx rx rx = ½ Formula Differencing Limitations • Differencing output often imprecise rx(v) = v’ : (x(v’)  n*(v’,v)) Action “x = xn” x rx alexey@cs.wisc.edu

  18. Reducing Loss of Precision from Differencing • Semantic minimization of formulas • Simplest case: propositional formulas • Work in progress • Removing unnecessary reevaluation • Finding common sub-formulas • Improvements to materialization • Exploiting important special cases • E.g., reachability in lists alexey@cs.wisc.edu

  19. ½ Information order 0 1 Three-Valued Logic • 1: True • 0: False • 1/2: Unknown • A join semi-lattice: 0  1 = 1/2 0  ½ 1  ½ alexey@cs.wisc.edu

  20. Semantic Minimization • (A): Value of formula  under assignment A • In 3-valued logic, (A) may equal ½ p + p’([p 0]) = 1 p + p’([p ½]) = ½ p + p’([p 1]) = 1 • However, 1([p 0]) = 1 1([p ½]) = 1 1([p 1]) = 1 alexey@cs.wisc.edu

  21. 1([p 0]) = 1 = p + p’([p 0]) 1([p ½]) = 1  ½ = p + p’([p ½]) 1([p 1]) = 1 = p + p’([p 1]) Semantic Minimization 2-valued logic: 1 is equivalent to p + p’ 3-valued logic: 1 is better thanp + p’ For a given , is there a best formula? Yes! alexey@cs.wisc.edu

  22. Minimal? x +x’ x x’ xy + x’z xy + x’y’ xy + x’z+ yz xy’+ x’z’+ yz No! Yes! No! Yes! Yes! No! alexey@cs.wisc.edu

  23. A(A) (A) [x ½, y 1, z 1] 1 ½ Example Original formula () xy + x’z Minimal formula () xy+ x’z+ yz alexey@cs.wisc.edu

  24. A(A) (A) [x ½, y 0, z 0] 1 ½ [x 0, y 1, z ½] 1 ½ [x 1, y ½, z 1] 1 ½ Example Original formula () xy’+ x’z’+ yz Minimal formula () x’y + x’z’+ yz + xy’+ xz + y’z’ alexey@cs.wisc.edu

  25. Semantic Minimization • When  contains no occurrences of ½ and   primes() • In general, somewhat more complicated • Represent  with a pair floor:    ½ = 0 ceiling:    ½ = 1 • Semantically minimal formula  primes(  ) ( primes(   )) alexey@cs.wisc.edu

  26. Current and Future Work • Finite differencing of formulas • Minimization of first-order formulas • Generation of instrumentation predicates alexey@cs.wisc.edu

  27. Towards Abstraction Refinement in TVLA Alexey Loginov UW Madison alexey@cs.wisc.edu

More Related