Verifying Component Substitutability

20
Verifying Component Substitutability Nishant Sinha Edmund Clarke Natasha Sharygina Sagar Chaki Carnegie Mellon University

description

Verifying Component Substitutability. Nishant Sinha Edmund Clarke Natasha Sharygina Sagar Chaki Carnegie Mellon University. P. Substitutability Check. Assembly A. ?. Component C. Component C’. Motivation. Component-based Software Software modules shipped by separate developers - PowerPoint PPT Presentation

Transcript of Verifying Component Substitutability

Page 1: Verifying Component Substitutability

Verifying Component Substitutability

Nishant Sinha

Edmund ClarkeNatasha Sharygina

Sagar Chaki

Carnegie Mellon University

Page 2: Verifying Component Substitutability

Substitutability Check

Assembly A

Component CComponent C’

P ?

Page 3: Verifying Component Substitutability

Motivation

• Component-based Software– Software modules shipped by separate

developers– An assembly consists of several components– Undergo several updates/bug-fixes during their

lifecycle

• Component assembly verification– Necessary on update of any component– High verification costs of global properties– Instead check for substitutability of new

component

Page 4: Verifying Component Substitutability

Substitutability Check

• Given old and new components C, C’ and assembly A– Check if C’ is substitutable for C in A

• Two phases:– Containment check

• All interface behaviors of the previous component contained in new one

– Compatibility check• Safety with respect to other components in assembly: all global

specifications satisfied

• Formulation– Obtain a finite interface behavioral model of all components

by abstraction: labeled kripke structures – Use regular language inference in combination with a model

checker

Page 5: Verifying Component Substitutability

Predicate Abstraction into LKS

• Labeled Kripke Structures– <Q,,T,P,L>

• Composition semantics– Synchronize on shared actions

• Represents abstractions• State-event traces

– <p,,q,, ....>

p

!q

q

!p

Page 6: Verifying Component Substitutability

Predicate Abstraction into LKS

L1

lock = 0

if (x < y)

lock=1

x < y

if (x >= y)

lock = 0

x < y

if (x < y) x >= y

lock=1void OSSemPend(…) {

L1: lock = 1; if (x < y) { L2: lock = 0; … } if (x >= y) { … L3: lock = 0; … } else { … }}

L2

if (x >= y) x >= y

L3

Page 7: Verifying Component Substitutability

Component Interface LKS• Component

– A set of communicating concurrent C programs or libraries

• No recursion, inlined procedures

– Abstracted into a Component Interface LKS– Communication between components is abstracted into

interface actions– Interface LKS contains only interface actions

C1 C2 C3

M1 M2 M3

Component C

Component LKS M

Predicate Abstraction

Page 8: Verifying Component Substitutability

L* learner

Learning Regular languages: L*• Forms the basis of containment and compatibility

checks• L* proposed by D. Angluin

– Learning regular sets from queries and counterexamples, Information and Computation, 75(2), 1987.

• Polynomial in the number of states and length of counterexample

Minimally adequate Teacher

IsMember( trace )

IsCandidate( DFA D )

a

b

a

b

UnknownRegular Language

±Counterexample/ Yes

Modelchecker

Yes/No

Minimum DFA

Page 9: Verifying Component Substitutability

Containment

• Goal:– Learn useful behaviors from previous

component into the new one

• Given Component LKSs: M, M’ and Bug LKS B– Unknown U = L(M’) [ (L(M)n L(B))– Iteratively learn the DFA SM’i using L*

• Modelchecker– IsMember Query: 2 U– IsCandidate Query: U ´ L(SM’i) M M’

B

Page 10: Verifying Component Substitutability

Containment (contd.)

IsMember Query: 2 UIsCandidate Query: U ´ L(SM’i)

L* Learner

Modelchecker

OldComponent LKS

M

NewComponent LKS

M’ +

Bug LKSSM’

Page 11: Verifying Component Substitutability

Containment (contd.)

• In contrast to known Refinement-based approaches– Containment allows adding new behaviors in M’

e.g. M, M’ have different interleavings of same interface actions

– Erroneous new behavior detected in Compatibility check

• Finally SM’– substitutable candidate– may not be safe with respect to other components– must verify the global behavioral specifications

Page 12: Verifying Component Substitutability

Compatibility check

• Assume-guarantee to verify assembly properties– Similar to approach by Cobleigh et. al. at NASA Ames

• Generate a (smaller) environment assumption A– A: most general environment so that P holds

– Constructed iteratively using L* and R1, R2

R1: M1 || A ² PR2: M2 ² A

M1 || M2 ² P

Page 13: Verifying Component Substitutability

Compatibility check

R1: M1 || Ai ² P

R2: M2 ² Ai

trueL* Assumption

GenerationAi

true true

CE CE Analysis True CEM1 || 2 P

False CE

-CE for Ai

+CE for Ai

Page 14: Verifying Component Substitutability

Compatibility check (contd.)

• Generate a most general assumption for SM’– M1 = SM’

– M2 = Mn M (all other component LKSs)

• Membership queries:– SM’ || µ P

• Candidate queries:– SM’ || A µ P

– M2 µ A

• CE analysis: SM’ || CE µ P – Yes ) False CE– No ) True CE

Page 15: Verifying Component Substitutability

CEGAR

• Compatibility check infers– Either SM’ is substitutable– Or counterexample CE

• CE may be spurious wrt C, C’– CE is present in component LKS M or M’– Must refine M, M’– Repeat substitutability check

Page 16: Verifying Component Substitutability

C C’ An C

Containment

U ´ L(SM’i)

L* SM’

Compatibility

SM’ || A ² PM n M ² A

true Provide SM’to developer

M n MM M’B

Predicate Abstraction

falseCE

spurious?

refine M, M’

SM’ not substitutable, CE provided

Page 17: Verifying Component Substitutability

Feedback to the Developer

• If SM’ is substitutable– LKS showing how SM’ differs from M’

• If SM’ is not substitutable– counterexample showing the erroneous

behavior in M’

Page 18: Verifying Component Substitutability

Related Work

• Learning Assumptions: Cobleigh. et. al.– Do not consider state labeling of abstract models– Do not incorporate a CEGAR framework for AG

• Compatibility of Component Upgrades: Ernst et. al.– Do not consider temporal sequence of actions in

generating invariants

• Interface Automata: Henzinger et. al.– Do not have CEGAR, AG – No procedure for computing interface automata

Page 19: Verifying Component Substitutability

Experiments

• Prototype implementation in MAGIC framework

• Inter-process communication component assembly– modified WriteMessageToQueue component– checked for substitutability inside the assembly

of four components (read, write, queue, cs)

Page 20: Verifying Component Substitutability

Future Work

• Domain-specific learning • Algorithm for learning LKSs directly• Learning regular languages• Simulation check instead of trace

containment• Generation of source code/ statecharts• Learning of Context Free Languages