Software has bugs
- To find them, we use testing and code reviews
!
- But some bugs are still missed
- Rare features
- Rare circumstances
- Nondeterminism
Software has bugs To find them , we use testing and code reviews ! - - PowerPoint PPT Presentation
Software has bugs To find them , we use testing and code reviews ! But some bugs are still missed Rare features Rare circumstances Nondeterminism Static analysis Can analyze all possible runs of a program An explosion
!
!
confusion, false positives, error management,..
false positive rate down!
the analysis simpler
#!@?
!
fork symbolic executor
10.}! 11.assert(x+y+z != 3)
x=0, y=0, z=0 α x=-2 z=2 ✔ ✘ β<5 ¬α∧γ y=1 ✔ β<5 z=2 z=2 ✔ ✔
t f t f t f t f
α∧(β<5)
α∧(β≥5) ¬α∧(β≥5) ¬α∧(β<5)∧¬γ ¬α∧(β<5)∧γ
actual program runs
satisfy the path condition
execution space than testing
a formal system for testing and debugging programs by symbolic execution. In ICRS, pages 234–245, 1975.
CACM, 19(7):385–394, 1976. (most cited)
techniques using simulated execution. In ANSS, pages 171– 177, 1976.
symbolic evaluation system. IEEE Transactions on Software Engineering, 3(4):266–278, 1977.
feasible, which assertions could be false
and small (not much memory)
HP HPEC 2012 Waltha ham, M , MA Se Septemb mber 10-12, 2012 1950 1960 1970 1980 1990 2000 2010 2020 1E+0 1E+2 1E+4 1E+6 1E+8 1E+10 1E+12 1E+14 1E+16 1E+18
Dongarra and Luszczek, Anatomy of a Globally Recursive Embedded LINPACK Benchmark, HPEC 2012.! http://web.eecs.utk.edu/~luszczek/pubs/hpec2012_elb.pdf
200 400 600 800 1000 2002 2004 2006 2008 2010 Small Problem Big Problem
Results of SAT competition winners (2002-2010)
include symbolic variables, representing unknowns
! !
reproduces the bug when the program is run normally
e ::= n | X | e0 + e1 | e0 ≤ e1 | e0 && e1 | …
α |
able to compute symbolically
x = read();! y = 5 + x;! z = 7 + y;! a[z] = 1; Concrete Memory! x 0! y 0! z 0! a {0,0,0,0}
5 10 17
Symbolic Memory! x 0! y 0! z 0! a {0,0,0,0}
α 5+α 12+α
We’ll explain arrays shortly
! ! !
current path using a path condition π
1 x = read();! 2 if (x>5) { ! 3 y = 6;! 4 if (x<10)! 5 y = 5; ! 6 } else y = 0;
condition being satisfiable
1 x = read();! 2 if (x>5) { ! 3 y = 6;! 4 if (x<3)! 5 y = 5; ! 6 } else y = 0;
!
π = α>5
!
π = α>5 ∧ α<3 π = α≤5 π = α>5 ∧ α<3
to a concrete test case that will execute that path
1 x = read();! 2 y = 5 + x;! 3 z = 7 + y;! 4
a[z] = 1;
1 x = read();! 2 y = 5 + x;! 3 z = 7 + y;! 4 if(z < 0)! 5 abort();! 6 if(z >= 4);! 7 abort();! 8 a[z] = 1;
π = true π = true π = true π = true π = 12+α<0 π = ¬(12+α<0) π = ¬(12+α<0) ∧ 12+α≥4 π = ¬(12+α<0) ∧ ¬(12+α≥4)
paths reaching them are feasible), we have found an
condition and its negation
path (condition)s for later consideration
completion, then generate new input by changing the path condition
!
pc0 if (p) { ! pc1 …! pc2 } else { …
“edges” of the application
as the program runs
satisfy the path condition
for SMT solver