Producing Effective Interpolants for SAT-based Incremental - - PowerPoint PPT Presentation

producing effective interpolants for sat based
SMART_READER_LITE
LIVE PREVIEW

Producing Effective Interpolants for SAT-based Incremental - - PowerPoint PPT Presentation

Producing Effective Interpolants for SAT-based Incremental Verification and Upgrade Checking Grigory Fedyukovich Joint work with: Ondrej Sery, Simone Fulvio Rollini, Leonardo Alt, Antti E. J. Hyvrinen, and Natasha Sharygina F ORMAL V ERIFICATION


slide-1
SLIDE 1

Producing Effective Interpolants for SAT-based Incremental Verification and Upgrade Checking

Grigory Fedyukovich

Joint work with: Ondrej Sery, Simone Fulvio Rollini, Leonardo Alt,

Antti E. J. Hyvärinen, and Natasha Sharygina

FORMAL VERIFICATION LAB

University of Lugano VSSE 2014, 5 Apr 2014, Grenoble, France

slide-2
SLIDE 2

Motivation

  • Incremental checking of program correctness
  • One program, several properties
  • Eliminate redundancy in consequent verification runs
  • Checking upgrade correctness
  • Several programs, one property
  • Localize the verification to the change
  • Our methods
  • Use SAT-based Bounded Model Checking
  • Extracting function summaries by means of Craig Interpolation
  • Reusing function summaries in both scenarios
  • Controlling the size and strength of Craig Interpolants
  • Making the verification more efficient

2

slide-3
SLIDE 3

Background

Bounded Model Checking [Biere et al. 1999]

  • Successful technique to prove program safety
  • Static
  • Automatic
  • Gives a concrete counter-example or proof of safety
  • Loops and recursion unwound
  • Up to a given bound
  • Encoding into a BMC formula
  • Different logics available
  • Conjoin with the negation of a property
  • To encode an undesired bеhavior
  • Satisfiability check by a SAT/SMT-solver
  • UNSAT à System is safe
  • SAT à Error found
  • Satisfying assignment identifies an error trace
  • Problems
  • Detecting the bound enough for complete checking
  • Constructing abstractions of the behavior

3

slide-4
SLIDE 4

Program

Abstract model Model Checker

Refine the abstraction Verification Initial Abstraction

Safe Simulator

Simulation successful

Bug found Refinement

Counterexample is spurious Counterexample

Background

Counter-Example-Guided Abstraction Refinement [Ball et al. 2000]

Proof

4

slide-5
SLIDE 5

Background

Abstraction

  • Over-approximates program behavior
  • Is used to speed up verification
  • No precise encoding required
  • Sound
  • If it is proven to be safe then the original program is safe
  • Possibly non-terminating
  • Every detected bug should be simulated on the real program
  • After each spurious counter-example the abstraction should be refined
  • Refinement may not terminate
  • Random
  • How to construct better abstraction?

5

slide-6
SLIDE 6

Craig Interpolation

[Craig et al. 1957]

Definition:

  • Given mutually unsatisfiable formulas A and B, an

Interpolant is a formula I such that

  • A → I
  • I ∧ B is unsatisfiable
  • Variables in I are common to both A and B

A B I

6

slide-7
SLIDE 7

Definition:

  • Given mutually unsatisfiable formulas A and B, an

Interpolant is a formula I such that

  • A → I
  • I ∧ B is unsatisfiable
  • Variables in I are common to both A and B ∧ B

A B I’ I

Craig Interpolation

[Craig et al. 1957]

6

slide-8
SLIDE 8
  • Propositional logic, construction from unsatisfiablity proof
  • Generation of different interpolants from the same

refutation

  • Interpolants of different size and strength
  • Generalization of algorithms of:
  • P by [Pudlak 1997]
  • M by [McMillan 2003]
  • M’ by [D’Silva et.al 2010]

Labeled Interpolation System

[D’Silva et al. 2010]

M M’ P

7

slide-9
SLIDE 9

Proof reduction

Affects the size of summaries

  • Eliminate redundancies in the proof DAG
  • Applied before interpolation
  • Different methods available:
  • RecyclePivotsWithIntersection [Bar-Ilan et al. 2008, Fontaine et al. 2010]
  • LowerUnits [Fontaine et al. 2010]
  • Structural hashing based approach [Cotton et al. 2010]
  • Local rewriting rules [Rollini et al. 2010]
  • Practically, ends up with more compact interpolants
  • the smaller formula, the faster usage

8

slide-10
SLIDE 10

PeRIPLO high level overview

9

slide-11
SLIDE 11

PeRIPLO high level overview

The first …

  • set of techniques to obtain

interpolants of different strength and size

  • experimentation evidence

that compact interpolants improve performance in the context of software BMC

  • evaluation of the impact of

interpolant strength in Summarization-based BMC

9

Verification Environment Proof Transformer Logic Solver Interpolator

configure

f ᴧ

φ

PBMC formula

φ

g ᴧ ...

SAT UNSAT proof

  • f UNSAT

distibution A ᴧ B

  • interp. system;

interpolant A I

B ᴧ I → ⊥

PeRIPLO

slide-12
SLIDE 12

Function summaries in Bounded Model Checking

  • Apply Craig interpolation after SAT-solver returns

UNSAT

  • Iterative procedure over the set of function calls
  • BMC created in a partitioned way
  • Each function represented by a separate partition in the

BMC formula

  • Not monolithic as for classical BMC
  • Function summary
  • An over-approximation of the real behavior
  • Contains only the relevant information
  • Expressed using function’s in/out parameters

10

slide-13
SLIDE 13

Summaries substitution

During the check of another property of the same code

1) No error is reachable

à OK, program is safe

2) Error is reachable

A) due to over-approximation of summaries B) real error

Solution: Refine the abstraction

  • Identify candidate summaries
  • Appeared along the error trace
  • Replace them by precise representation

11

slide-14
SLIDE 14

Summaries substitution

During the check of another property of the same code

1) No error is reachable

à OK, program is safe

2) Error is reachable

A) due to over-approximation of summaries B) real error

Refinement of the abstraction:

  • Identify candidate summaries
  • Appeared along the error trace
  • Replace them by precise representation

12

Σ Σ Σ Σ

slide-15
SLIDE 15

Partitioned BMC

main() ¡ call ¡g() ¡ return ¡

φmain φf φg

∧ ∧

return ¡ return ¡ call ¡f() ¡

UNSAT ¡ ⇔ asser0on ¡holds ¡

φbug

assert(!bug); ¡

13

slide-16
SLIDE 16

Construction of function summaries

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φg φbug

assert(!bug); ¡

A ¡∧ B ¡ ¡

UNSAT ¡

A B B B

13

slide-17
SLIDE 17

Construction of function summaries

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φg φbug

assert(!bug); ¡

A ¡∧ B ¡ ¡

UNSAT ¡ proof ¡of ¡UNSAT ¡

A B B B

13

slide-18
SLIDE 18

Construction of function summaries

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φg

A ⇒ I

φbug

assert(!bug); ¡

¡∧ B ¡ ¡

UNSAT ¡

I

proof ¡of ¡UNSAT ¡

A B B B I

13

slide-19
SLIDE 19

Using summary

for checking another assertion

main() ¡ call ¡g() ¡ return ¡ assert(!bug'); ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

UNSAT ¡ ⇔ asser0on ¡holds ¡

φbug' φg

14

Subs0tute ¡existent ¡ summary ¡instead ¡of ¡ precise ¡encoding ¡

slide-20
SLIDE 20

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

UNSAT ¡ ⇔ asser0on ¡holds ¡

φg

14

Using summary

for checking another assertion

assert(!bug'); ¡

φbug'

Subs0tute ¡existent ¡ summary ¡instead ¡of ¡ precise ¡encoding ¡

slide-21
SLIDE 21

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

SAT ¡ ⇔ bug ¡witness ¡

φg φbug

The ¡more ¡accurate ¡ summary, ¡the ¡be1er ¡ chance ¡to ¡prove ¡safety! ¡

14

Using summary

for checking another assertion

assert(!bug'); ¡

φbug'

slide-22
SLIDE 22

Interpolation algorithms

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

P by [Pudlak 1997] M by [McMillan 2003] M’ by [D’Silva et al. 2010]

M’ M P

The ¡stronger ¡interpolant, ¡the ¡ more ¡accurate ¡summary! ¡

14

φg

assert(!bug'); ¡

φbug'

slide-23
SLIDE 23

parser

goto-cc

initializer

eager/lazy

refiner

CEG/greedy

PBMC encoder summaries solver

PeRIPLO *.c *.h

sources Correct Bug

& error trace

*

Σ Σ

*

Σ Σ Σ

initial subst. scenario refined subst. scenario new summaries known summaries SAT UNSAT

φfᴧ φgᴧ ...

PBMC formula goto binary

15

slide-24
SLIDE 24

FunFrog evaluation

  • 50 C benchmarks
  • Assertions on

different call-tree levels

  • Checking one

assertion at a time

  • Strength: M, P, M’
  • Size: proof

compression for interpolants reduction

16

slide-25
SLIDE 25

FunFrog evaluation

17

slide-26
SLIDE 26

Function-summarization-based Upgrade Checking

The eVolCheck algorithm

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

18

slide-27
SLIDE 27

Function-summarization-based Upgrade Checking

The eVolCheck algorithm

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

1) The user upgrades the software 2) Upgraded version of the software is preprocessed 3) eVolCheck identifies the modified code

  • by comparing parse trees for both the base and the upgraded version
  • function per function, in the intermediate program representation

4) eVolCheck attempts to verify the upgraded version

4) by rechecking whether old summaries still over-approximate new code

5) If all old function summaries are still valid then the upgrade is safe 6) If a summary is invalid, eVolCheck propagates 6) The user fixes the reported errors and continues from step 2)

18

slide-28
SLIDE 28

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φbug

assert(!bug); ¡

φg

Upgrade Checking [Fedyukovich et al. 2013]

Original version is safe

19

slide-29
SLIDE 29

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φbug

assert(!bug); ¡

φg

Upgrade Checking

Function g was modified to g’

19

Recheck ¡old ¡ summary ¡

φg'

slide-30
SLIDE 30

main() ¡ call ¡g() ¡ return ¡

φmain φf

∧ ∧

return ¡ return ¡ call ¡f() ¡

φbug

assert(!bug); ¡

Upgrade Checking

After the code of g was modified

19

The ¡less ¡accurate ¡summary, ¡ the ¡be1er ¡chance ¡to ¡verify ¡an ¡ upgrade! ¡

φg

Recheck ¡old ¡ summary ¡

φg'

slide-31
SLIDE 31

function summaries *.c *.h version N - 1

  • riginal

summaries model (goto binary)

parser goto-cc *.c *.h version N comparator goto-difg

eVolCheck

stored from last verification parser goto-cc refiner downward PBMC encoder solver PeRIPLO

SAT

φfᴧφ

gᴧ ...

PBMC formula

Bug

& error trace

Safe

updated summaries (interpolation) UNSAT

software evolution

refiner upward callgraph traversal summary checker

all valid main() invalid invalid summary valid summary check caller check summary

20

slide-32
SLIDE 32

eVolCheck evaluation

  • 50 C benchmarks
  • Assertions on different

call-tree levels

  • Checking all assertions

at the same time

  • Strength: M, P
  • M’ does not satisfy tree-

interpolation property [Rollini et al. 2012]

  • Size: proof compression

for interpolants reduction 21

slide-33
SLIDE 33

eVolCheck evaluation

22

slide-34
SLIDE 34

Implementation

  • FunFrog and eVolCheck
  • http://verify.inf.usi.ch/content/funfrog

http://verify.inf.usi.ch/content/evolcheck

  • Based on the CProver framework
  • D. Kroening et al.

http://cprover.org

  • PeRIPLO
  • SAT checks by MiniSAT
  • Proof reduction
  • Interpolation
  • Available:
  • Binary:

http://verify.inf.usi.ch/content/periplo

  • Open Source:

http://periplo.googlecode.com/svn ¡

23

slide-35
SLIDE 35

Conclusion

  • Summary is an over-approximation of the real behavior
  • A more accurate summary is better for FunFrog
  • A less accurate summary is better for eVolCheck
  • Constructed from the same proof of unsatisfiability
  • Using different algorithms of Craig Interpolation (M, P, M’)
  • Proof reduction
  • Affects the size of resulting formulas
  • The smaller size of summary, the better for usage
  • PeRIPLO evaluation:
  • The first systematic evaluation of the impact of interpolant

strength in summarization-based BMC

24

slide-36
SLIDE 36

Future work

  • How proof reduction affects the strength of

interpolants?

  • Maximal distance (e.g., number of models)

between M, P, M’

  • LIS-based interpolant minimization
  • Interpolation in SMT (e.g., in OpenSMT by

[Bruttomesso et al. 2010])

25

slide-37
SLIDE 37

Thank you!

20

slide-38
SLIDE 38

Emergency slides

20

slide-39
SLIDE 39

parser

goto-cc

initializer

eager/lazy

refiner

CEG/greedy

PBMC encoder summaries solver

PeRIPLO *.c *.h

sources Correct Bug

& error trace

*

Σ Σ

*

Σ Σ Σ

initial subst. scenario refined subst. scenario new summaries known summaries SAT UNSAT

φfᴧ φgᴧ ...

PBMC formula goto binary

39

slide-40
SLIDE 40

function summaries *.c *.h version N - 1

  • riginal

summaries model (goto binary)

parser goto-cc *.c *.h version N comparator goto-difg

eVolCheck

stored from last verification parser goto-cc refiner downward PBMC encoder solver PeRIPLO

SAT

φfᴧφ

gᴧ ...

PBMC formula

Bug

& error trace

Safe

updated summaries (interpolation) UNSAT

software evolution

refiner upward callgraph traversal summary checker

all valid main() invalid invalid summary valid summary check caller check summary

40

slide-41
SLIDE 41

Summaries substitution

During the check of another property of the same code

1) No error is reachable

à OK, program is safe

2) Error is reachable

A) due to over-approximation of summaries B) real error

Solution: Refine the abstraction

  • Identify candidate summaries
  • Appeared along the error trace
  • Replace them by precise representation

41

slide-42
SLIDE 42

Summaries substitution

During the check of another property of the same code

1) No error is reachable

à OK, program is safe

2) Error is reachable

A) due to over-approximation of summaries B) real error

FunFrog: refine the abstraction

  • Identify candidate summaries
  • Appeared along the error trace
  • Replace them by precise representation

Σ Σ Σ Σ

42

slide-43
SLIDE 43

Partitioned Bounded Model Checking

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

φ1

main

φ2

main

φf φ1

h

φ2

h

φ1

g

φ2

g

φ3

g

φassert ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∧

UNSAT ¡ ⇔ asser0on ¡holds ¡

43

slide-44
SLIDE 44

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

φ1

main

φ2

main

φf φ1

h

φ2

h

φ1

g

φ2

g

φ3

g

φassert ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∧

UNSAT ¡ ⇔ asser0on ¡holds ¡ proof ¡of ¡UNSAT ¡

Partitioned Bounded Model Checking

44

slide-45
SLIDE 45

Function summaries

  • An over-approximation of the real behavior
  • Considering the given bound
  • Contains only the relevant information
  • Generated from the proof of UNSAT

à Derived using Craig interpolation

45

slide-46
SLIDE 46

Function summaries

without updates

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

φ1

main

φ2

main

φf φ1

h

φ2

h

φ1

g

φ2

g

φ3

g

φassert ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∧

UNSAT ¡ ⇔ asser0on ¡holds ¡ proof ¡of ¡UNSAT ¡

46

slide-47
SLIDE 47

Function summaries

without updates

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

φ1

main

φ2

main

φf φ1

h

φ2

h

φ1

g

φ2

g

φ3

g

φassert ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∧

A B ⇒ I

func0on ¡ summary ¡

∧ I is ¡UNSAT ¡

47

slide-48
SLIDE 48

Interpolation-based function summaries

  • Function summary
  • An over-approximation of the real behavior
  • Considering the given bound
  • Contains only the relevant information
  • Generated from the proof of UNSAT
  • Expressed using function’s in/out parameters
  • Usage

1) Same code, different properties

  • To approximate the corresponding functions

2) Same properties, different code

  • Upgrade checking

Sery O., Fedyukovich G., Sharygina N., Interpolation-based Function Summaries in Bounded Model Checking, HVC 2011.

48

slide-49
SLIDE 49

Upgrades – key idea

Observations:

  • An old summary can remain a valid over-

approximation of the new version of a modified function

  • Old summaries are precise enough to prove

the properties of interest Idea: Do a cheap local check…

49

slide-50
SLIDE 50

Upgrade arrived!

example of summaries

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡5; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡

50

slide-51
SLIDE 51

Upgrade arrived!

example of summaries

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡ (a ¡> ¡0) ¡-­‑> ¡ (f_return ¡>= ¡0) ¡

  • ld summary

int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡5; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡

does it still over- approximate new behavior?

51

slide-52
SLIDE 52

Function summaries

with updates

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

new ¡version ¡of ¡f() ¡

52

slide-53
SLIDE 53

Function summaries

with updates

main() ¡ call ¡f() ¡ return ¡ call ¡g() ¡ return ¡ call ¡h() ¡ return ¡ call ¡h() ¡ return ¡ assert(i ¡< ¡size); ¡

φf

B ⇒ I

func0on ¡ summary ¡ new ¡version ¡of ¡f() ¡

φ’f

∧ I is ¡UNSAT ¡

Two ¡cases: ¡

  • Lucky: ¡If ¡φ’f ¡⇒ I then ¡we ¡are ¡done ¡
  • Unlucky: ¡We ¡need ¡expand ¡the ¡context ¡
  • S=ll, ¡summaries ¡of ¡h() ¡can ¡help ¡us ¡

to ¡minimize ¡the ¡effort ¡needed ¡

53

slide-54
SLIDE 54

The algorithm

  • verview

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

1) The user upgrades the software 2) Upgraded version of the software is parsed by goto-cc 3) eVolCheck identifies the modified code

  • by comparing parse trees for both the base and the upgraded version

4) eVolCheck attempts to verify the upgraded version

  • using cheap local checks based on the function summaries of the last version

5a) If successful, eVolCheck updates function summaries for next checks 5b) If unsuccessful, eVolCheck reports violation + an error trace 6) The user fixes the reported errors and continues from step 2)

54

slide-55
SLIDE 55

Bootstrap check

formula construction

φmain φ2 φ5 φ1 φ3 φ4 φ6 φ1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ4 ˄ φ5 ˄ φ6 ˄ errormain f1 f3 f2 f4 f6 f5

main

UNSAT ¡

55

slide-56
SLIDE 56

Bootstrap check

generation of summaries

I1 I2 Imain I3 I4 I6 I5 φmain φ2 φ5 φ1 φ3 φ4 φ6 f1 f3 f2 f4 f6 f5

main

UNSAT ¡ A ¡ B ¡ φ1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ4 ˄ φ5 ˄ φ6 ˄ errormain

56

slide-57
SLIDE 57

Bootstrap check

properties of interpolant-based summaries

f1 f3 f2 f4 f6 f5

main

UNSAT ¡ (i) A → I (ii) I ˄ B ¡is ¡UNSAT ¡ (iii) shared symbols Imain φ1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ4 ˄ φ5 ˄ φ6 ˄ errormain φ1 ˄ φ2 ˄ φ3 ˄ φmain ˄ I5 ˄ errormain I1 I2 I3 I4 I6 I5 φ2 φ5 φ1 φ3 φ4 φ6 φmain

57

slide-58
SLIDE 58

eVolCheck

  • Overview
  • Incremental upgrade checker for C
  • Bounded model checking
  • Function summaries
  • Key idea
  • Local upgrade check using function summaries
  • Focus on the modified code
  • Local check → cheap check

58

slide-59
SLIDE 59

Partitioning BMC

example of summaries

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡

59

slide-60
SLIDE 60

Partitioning BMC

example of summaries

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡

60

slide-61
SLIDE 61

Partitioning BMC

example of summaries

summary

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡ (a ¡> ¡0) ¡-­‑> ¡ (f_return ¡>= ¡0) ¡

=>

  • ver-

approximates real behavior!

61

slide-62
SLIDE 62

Partitioning BMC

example of summaries

void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0) ¡ ¡ ¡ ¡ ¡y ¡= ¡f(x); ¡ ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡ ¡ int ¡f(int ¡a) ¡{ ¡ ¡ ¡if ¡(a ¡< ¡10) ¡ ¡ ¡ ¡ ¡return ¡a; ¡ ¡ ¡return ¡a ¡– ¡10; ¡ } ¡ ¡ (a ¡> ¡0) ¡-­‑> ¡ (f_return ¡>= ¡0) ¡ void ¡main() ¡{ ¡ ¡ ¡int ¡y ¡= ¡1; ¡ ¡ ¡int ¡x ¡= ¡nondet(); ¡ ¡ ¡ ¡if ¡(x ¡> ¡0){ ¡ ¡ ¡ ¡ ¡assume(y ¡>= ¡0); ¡ ¡ ¡} ¡ ¡ ¡assert(y ¡>= ¡0); ¡ } ¡

use of summary => =>

62

slide-63
SLIDE 63

Correctness

UNSAT ¡ φmain f'1 f3 f2 f'4 f6 f5

main

φ'1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ'4 ˄ φ5 ˄ φ6 ˄ errormain

? ¡

φ'1 φ'4 φ2 φ5 φ3 φ6

63

slide-64
SLIDE 64

Correctness

UNSAT ¡ Imain ˄ errormain φmain f'1 f3 f2 f'4 f6 f5

main

? ¡

(iv) tree interpolant property: φf ˄ Ichild1 ˄ … ˄ Ichildn → If φ'1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ'4 ˄ φ5 ˄ φ6 ˄ errormain φ'1 φ'4 φ2 φ5 φ3 φ6 I'4 I'6 I1 I2 I3 I5

64

slide-65
SLIDE 65

f'1 f2 f'4 f6 f5

main

f3 ˄ ˄ ˄ ˄ ˄ ˄

Correctness

UNSAT ¡ Imain ˄ errormain φmain

? ¡

(iv) tree interpolant property: φf ˄ Ichild1 ˄ … ˄ Ichildn → If UNSAT ¡ φ'1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ'4 ˄ φ5 ˄ φ6 ˄ errormain φ'1 φ'4 φ2 φ5 φ3 φ6 I'4 I'6 I1 I2 I3 I5

65

slide-66
SLIDE 66

f'1 f2 f'4 f6 f5

main

f3 ˄ ˄ ˄ ˄ ˄ ˄

Correctness

UNSAT ¡ Imain ˄ errormain φmain (iv) tree interpolant property: φf ˄ Ichild1 ˄ … ˄ Ichildn → If UNSAT ¡

ü ü ¡

φ'1 ˄ φ2 ˄ φ3 ˄ φmain ˄ φ'4 ˄ φ5 ˄ φ6 ˄ errormain φ'1 φ'4 φ2 φ5 φ3 φ6 I'4 I'6 I1 I2 I3 I5

66

slide-67
SLIDE 67

The algorithm

  • verview

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

1) The user upgrades the software 2) Upgraded version of the software is parsed by goto-cc 3) eVolCheck identifies the modified code

  • by comparing parse trees for both the base and the upgraded version

4) eVolCheck attempts to verify the upgraded version

  • using cheap local checks based on the function summaries of the last version

5a) If successful, eVolCheck updates function summaries for next checks 5b) If unsuccessful, eVolCheck reports violation + an error trace 6) The user fixes the reported errors and continues from step 2)

67

slide-68
SLIDE 68

Incremental upgrade check

Imain φmain f1 f3 f2 f4 f6 f5

main

Func=ons ¡f1 ¡and ¡f4 ¡upgraded… ¡

I1 I2 I3 I4 I6 I5 φ2 φ5 φ1 φ3 φ4 φ6

68

slide-69
SLIDE 69

Incremental upgrade check

Imain φmain φ'1 φ'4 f'1 f3 f2 f'4 f6 f5

main

Func=ons ¡f1 ¡and ¡f4 ¡upgraded… ¡

I1 I2 I3 I4 I6 I5 φ2 φ5 φ3 φ6

69

slide-70
SLIDE 70

Incremental upgrade check

Imain φmain f'1 f3 f2 f'4 f6 f5

main

We ¡a1empt ¡to ¡verify ¡that ¡summaries ¡I1 ¡ and ¡I4 ¡are ¡s=ll ¡valid ¡over-­‑approxima=ons. ¡

φ'1 φ'4 I1 I2 I3 I4 I6 I5 φ2 φ5 φ3 φ6

70

slide-71
SLIDE 71

Incremental upgrade check

Imain φmain f'1 f3 f2 f'4 f6 f5

main

Check ¡for ¡I1: ¡

φ'1 → I1 ü

ü ¡upgrade ¡is ¡safe ¡

φ'1 φ'4 I1 I2 I3 I4 I6 I5 φ2 φ5 φ3 φ6

71

slide-72
SLIDE 72

Incremental upgrade check

Imain φmain f'1 f3 f2 f'4 f6 f5

main

Check ¡for ¡I4: ¡

φ'4 → I4 x

ü ü ¡upgrade ¡is ¡safe ¡

propagate ¡upwards ¡

φ'1 φ'4 I1 I2 I3 I4 I6 I5 φ2 φ5 φ3 φ6

Check ¡for ¡I1: ¡

φ'1 → I1

72

slide-73
SLIDE 73

I6 I6

Incremental upgrade check

Imain φmain f'1 f3 f2 f'4 f6 f5

main

Check ¡for ¡I4: ¡

φ'4 → I4 x

ü ü ¡upgrade ¡is ¡safe ¡

propagate ¡upwards ¡

φ'4 ˄ φ5 ˄ I6 → I5 x refine ¡downwards ¡ φ'4 ˄ φ5 ˄ φ6 → I5

ü ü ¡upgrade ¡is ¡safe ¡

φ'1 φ'4 I1 I2 I3 I4 I5 φ2 φ5 φ3 φ6

Check ¡for ¡I1: ¡

φ'1 → I1

73

slide-74
SLIDE 74

Incremental upgrade check

Imain φmain f'1 f3 f2 f'4 f6 f5

main

x

ü ü ¡upgrade ¡is ¡safe ¡

propagate ¡upwards ¡

x refine ¡downwards ¡

ü ü ¡upgrade ¡is ¡safe ¡

Note ¡that ¡ ¡ ¡ ¡ ¡ ¡is ¡checked ¡as ¡ UNSAT ¡of: ¡

φ'4 ˄ φ5 ˄ φ6 ˄ ¬I5

… ¡we ¡can ¡regenerate ¡ summaries ¡

I6 φ'1 φ'4 I1 I2 I3 I4 I5 φ2 φ5 φ3 φ6

Check ¡for ¡I1: ¡

φ'1 → I1

Check ¡for ¡I4: ¡

φ'4 → I4 φ'4 ˄ φ5 ˄ I6 → I5 φ'4 ˄ φ5 ˄ φ6 → I5

74

slide-75
SLIDE 75

Incremental upgrade check

Imain I'4 I'6 φmain f'1 f3 f2 f'4 f6 f5

main

φ'1 φ'4

Check ¡for ¡I4: ¡

φ'4 → I4 x

Check ¡for ¡I1: ¡

φ'1 → I1 ü

ü ¡upgrade ¡is ¡safe ¡

propagate ¡upwards ¡

φ'4 ˄ φ5 ˄ I6 → I5 x refine ¡downwards ¡

ü ü ¡upgrade ¡is ¡safe ¡

Note ¡that ¡ ¡ ¡ ¡ ¡ ¡is ¡checked ¡as ¡ UNSAT ¡of: ¡ … ¡we ¡can ¡regenerate ¡ summaries ¡

I1 I2 I3 I5 φ2 φ5 φ3 φ6 φ'4 ˄ φ5 ˄ φ6 → I5 φ'4 ˄ φ5 ˄ φ6 ˄ ¬I5

75

slide-76
SLIDE 76

Function-summarization-based Upgrade Checking

The eVolCheck algorithm

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

15

slide-77
SLIDE 77

Function-summarization-based Upgrade Checking

The eVolCheck algorithm

0) Verification of the base version of the software (bootstrap)

  • function summaries generated and stored

1) The user upgrades the software 2) Upgraded version of the software is preprocessed 3) eVolCheck identifies the modified code

  • by comparing parse trees for both the base and the upgraded version
  • function per function, in the intermediate program representation

4) eVolCheck attempts to verify the upgraded version

4) by rechecking whether old summaries still over-approximate new code

5) If all old function summaries are still valid then the upgrade is safe 6) If a summary is invalid, eVolCheck propagates 6) The user fixes the reported errors and continues from step 2)

15

slide-78
SLIDE 78

Function Summarization

Related Work

  • Hoare logic [Hoare et al. 1971]
  • {Pre}Fun{Post} – specification of a function
  • Interprocedural analysis [Engler et al. 2003, Babicet al. 2008]
  • Under-approximation, i.e., expression for specific to particular values input / output
  • Verifying pushdown systems [Basler et al. 2007]
  • Expensive quantified expressions
  • Explicit-state Model Checking [Qadeer et al. 2004]
  • Tuples of explicit input / output values
  • Lazy annotation [McMillan et al. 2010]
  • Extracted from the infeasible execution paths
  • Guessing summaries [Leino, Flanagan et al. 2000]
  • Heuristic approach
  • Interpolation-based [Albarghouthi et al. 2012]
  • Based on under-approximation, created iteratively
  • Our approach is beneficial
  • Over-approximating and general enough, created at once
  • Property-dependent
  • Cheap construction
  • Applied to upgrade checking

16

slide-79
SLIDE 79

Implementation

  • FunFrog and eVolCheck
  • http://tverify.inf.usi.ch/content/funfrog
  • http://tverify.inf.usi.ch/content/evolcheck
  • Based on the CProver framework
  • D. Kroening et al.

http://cprover.org

  • Bounded model checking
  • Function summarization
  • Uses the PeRIPLO solver
  • For SAT checks & interpolation

http://tverify.inf.usi.ch/content/periplo ¡

17

slide-80
SLIDE 80

parser

goto-cc

initializer

eager/lazy

refiner

CEG/greedy

PBMC encoder summaries solver

PeRIPLO *.c *.h

sources Correct Bug

& error trace

*

Σ Σ

*

Σ Σ Σ

initial subst. scenario refined subst. scenario new summaries known summaries SAT UNSAT

φfᴧ φgᴧ ...

PBMC formula goto binary

18

slide-81
SLIDE 81

19