ESP ESP -
- Path
Path-
- Sensitive
Sensitive Program Verification in Program Verification in Polynomial Time Polynomial Time
- M. Das, S. Lerner, M. Seigle
- M. Das, S. Lerner, M. Seigle
ESP - - Path Path- -Sensitive Sensitive ESP Program - - PowerPoint PPT Presentation
ESP - - Path Path- -Sensitive Sensitive ESP Program Verification in Program Verification in Polynomial Time Polynomial Time M. Das, S. Lerner, M. Seigle M. Das, S. Lerner, M. Seigle PLDI '02 PLDI '02 Partial program verification
$uninit $error Opened Open Close Open, Print, Close Print, Close Print Open
void main(){ void main(){ if (dump) if (dump) f = fopen(dumpFil, "w"); f = fopen(dumpFil, "w"); if (p) if (p) x = 0; x = 0; else else x = 1; x = 1; if (dump) if (dump) fclose(f); fclose(f); } }
void main(){ void main(){ if (dump) if (dump) f = fopen(dumpFil, "w"); f = fopen(dumpFil, "w"); if (p) if (p) x = 0; x = 0; else else x = 1; x = 1; if (dump) if (dump) fclose(f); fclose(f); } }
[ $uninit ] [ $uninit, Opened ] [ $uninit, Opened ] [ $uninit, $error]
void main(){ void main(){ if (dump) if (dump) f = fopen(dumpFil, "w"); f = fopen(dumpFil, "w"); if (p) if (p) x = 0; x = 0; else else x = 1; x = 1; if (dump) if (dump) fclose(f); fclose(f); } }
[ $uninit ] [ $uninit, ¬d] [Opened, d] [ $uninit, ¬ d, ¬ p, x =1] [ $uninit, ¬ d, p, x = 0] [ Opened, d, ¬ p, x =1] [ Opened, d, p, x =0] Only one of the two paths possible from each state
path-
insensitive -
merge everything
path-
sensitive -
no merges
property simulation -
merge only info "irrelevant" for the property being verified property being verified
S
S →
S
cs(ss) = ss
df(ss) = {
s ∈ ∈ ss ss as(s),
s ∈ ∈ ss ss es(s)]}
as = {[{d},
s ∈ ∈ ss[d] ss[d] es (s)] | d
void main(){ void main(){ if (dump) if (dump) f = fopen(dumpFil, "w"); f = fopen(dumpFil, "w"); if (p) if (p) x = 0; x = 0; else else x = 1; x = 1; if (dump) if (dump) fclose(f); fclose(f); } }
[ $uninit ] [ $uninit, ¬d] [Opened, d] [ $uninit, ¬ d, ¬ p, x =1] [ $uninit, ¬ d, p, x = 0] [ Opened, d, ¬ p, x =1] [ Opened, d, p, x =0]
void main(){ void main(){ if (dump) if (dump) f = fopen(dumpFil, "w"); f = fopen(dumpFil, "w"); if (p) if (p) x = 0; x = 0; else else x = 1; x = 1; if (dump) if (dump) fclose(f); fclose(f); } }
[ $uninit ] [ $uninit, ¬d] [Opened, d] [ $uninit, ¬ d] [ Opened, d] No changes to property state Only one of the two paths possible from each state
Analysis exploits this by using a theorem prover to attempt to determine whether path is feasible from a given symbolic determine whether path is feasible from a given symbolic state state
H is the lattice height
E is the number of edges in CFG
D is the number of property states
T is the cost of one call to the flow function (includes deciding branch feasibility), J is join, Q is deciding equality deciding branch feasibility), J is join, Q is deciding equality on
execution states. execution states.
2 |E||D|)
Property state stays same here, so analysis won’t save correlation between flag and dump Property states will be $uninit and Opened Potential error here!
gcc (140,000 LOC)
FSM
Mapping from source code patterns to FSM transitions and to stateful value creation to stateful value creation
e = fopen(...) Open Yes C code pattern Transition Creation? fprintf(e, _ ) Print No fclose(e) Close No
fprintf in gcc
for each file handle, core code analyzed twice – – with this file with this file
fprintf fprintf