SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Software Verification:
                  State-Event-based Reasoning
                     and Deadlock Detection


                                         Natasha Sharygina


                             Joint work with Sagar Chaki, Ed Clarke, Joel
                                              Ouaknine


USI-CMU summer school 2007                    Natasha Sharygina
Objectives
         C program verification
           Sequential and concurrent


         Properties involve both data (states) and
         communication (events)
           Specified as (State/Event) LTL formulas
           Safety and Liveness


         Communication via shared actions
           Synchronous communication
           Asynchronous execution


USI-CMU summer school 2007   Natasha Sharygina       2
Bluetooth L2CAP Spec


   “When an L2CAP_ConnectRsp event is received in a
   W4_L2CAP_CONNECT_RSP state, an L2CAP process
   may send out an L2CA_ConnectInd event, disable the RTX
   timer, and move to state CONFIG.”
                               …
              Spec involves both states and events




USI-CMU summer school 2007   Natasha Sharygina        3
Labelled Kripke Structures
        Directed graph with labels on edges and states,
        (S,Init,P,L,T,Σ,E)
              Every state is labeled with a set of atomic
              propositions, P, true in the state                               0,1
              Every LKS comes with
              an alphabet of actions, Σ                                   a          a
                                                              b     1,1                  1,0

                                                                          b          c
        State labeling function : L: S                        2P               0,0

        Transition labeling function : E : T                       (2Σ  {})
              Assumption: LKSs are deadlock-free
                 [see deadlock detection algorithm, later in this lecture]



USI-CMU summer school 2007                Natasha Sharygina                                    4
Traces and Languages


          Trace: infinite alternating sequence of
          states and actions
                 (s1 a s2 b s4 b s1…)
                                                                      s1


                                                                  a        a
                                                         b   s2                s3

          Language: set of all traces                             b        c
                 L(M) = {s1 a (s2 b + s3 c) s4 b}ω
                                                                      s4



                                                                      M
USI-CMU summer school 2007           Natasha Sharygina                         5
Surge Protector : State/Event

                                                    m2


                                              m1 c0 c1

                                   m1                              m2             m2
m0                                                                                 c0
c0          m=0                                   m=1                       m=2    c1
                                   m0                              m1             c2

                                                    m0


                      State/Event model of the Surge Protector
                              (example is given for m: [0..2], c: [0..2])
 USI-CMU summer school 2007                    Natasha Sharygina                  6
Surge Protector : State Only


                       m=0                          m=1                      m=2
                       c=0                          c=0                      c=0




                       m=0                          m=1                      m=2
                       c=1                          c=1                      c=1




                       m=0                          m=1                      m=2
                       c=2                          c=2                      c=2


                             Kripke structure of the Surge Protector
                               (example is given for m: [0..2], c: [0..2])
USI-CMU summer school 2007                      Natasha Sharygina                  7
State/Event LTL

Given LKS M = (S,Init,P,L,T,Σ,E), and p ∈ P, a                         ∈ Σ,
                       ϕ ::= p | a | ~ϕ | ϕ & ϕ | Xϕ | Gϕ | Fϕ | ϕ Uϕ

  π = (s1 a1 s2 a2 …) is a path and πi is the suffix of π starting at state si

  π╞ p iff s1 is the first state of π and p ∈ L(s1)
  π╞ a iff a is the first action of π
  π╞ ∼ϕ iff ∼(π╞ ϕ)
  π╞ Xϕ iff π2╞ ϕ
  π╞ ϕ1 U ϕ2 iff there is some i ≥ 1 such that πi╞ ϕ2
                  and for all 1 ≥ j ≥ i - 1, πj╞ ϕ1

                             M╞ ϕ iff, for every path π ∈ L(M), π╞ ϕ
USI-CMU summer school 2007                  Natasha Sharygina                 8
Surge Spec : State/Event

                                            m2


                                      m1 c0 c1

                               m1                          m2         m2
m0                                                                     c0
c0          m=0                           m=1                   m=2    c1
                               m0                          m1         c2

                                            m0


                        G ((c2 → m=2) & (c1 → (m=1 V m=2)))
 USI-CMU summer school 2007            Natasha Sharygina              9
Surge Spec : State Only


                       m=0                    m=1                 m=2
                       c=0                    c=0                 c=0




                       m=0                    m=1                 m=2
                       c=1                    c=1                 c=1




                       m=0                    m=1                 m=2
                       c=2                    c=2                 c=2


                        G (((c=0 V c=2) & X (c=1)) → (m=1 V m=2)) &
                              G (((c=0 V c=1) & X (c=2)) → m=2)
USI-CMU summer school 2007                Natasha Sharygina             10
Surge Protector Verification


• Changes of current beyond threshold are disallowed

• State/Event Formula: G ((c2 → m=2) & (c1 → (m=1 V m=2)))

• State Formula: G (((c=0 V c=2) & X (c=1)) → (m=1 V m=2))
               & G (((c=0 V c=1) & X (c=2)) → m=2)

• Event Formula: G (m0 → ((∼c1 W (m1 V m2) ) ) &
                 G (m0 → ((∼c2 W m2)) &
                 G (m1 → ((∼c2 W m2))




USI-CMU summer school 2007   Natasha Sharygina               11
Automata-based Verification
 Given:                       M – LKS over Σ, P
                              ϕ – SE/LTL formula
 How to check:               M╞ ϕ

 Possible Approach:
 1. Convert M into a conventional state-only Kripke structure
 2. Convert ϕ into a state-only LTL formula
 3. Check whether M╞ ϕ
 Inefficient!
 What we do:
 1. Interpret ϕ as an LTL formula over Σ U P
 2. Compute B~ϕ (using Wring [Somenzi, Bloem’00])
 3. Construct M ⊗ B~ϕ (result is a Buchi automaton)
 4. Theorem: We have L (M ⊗ B~ϕ ) = {} iff M╞ ϕ
 No extra cost in time or space!
USI-CMU summer school 2007          Natasha Sharygina           12
Verification Results
   Current                   State Formula                          Event Formula                     State/Event Formula
    range
                    Aut. Size                Time       Aut. Size                Time           Aut. Size               Time


                   St        Tr       BC        MC      St     Tr         BC            MC      St     Tr       BC             MC

                    4         5       0.25      0.383   6      10        0.245          0.32    3       4       0.184          0.252
     2
                   14        23       0.49      1.141   20     41        1.597          1.77    5       8       0.243          0.391
     4
                   32        57       2.43      4.818   42     92        12.08          12.66   7      12       0.614          0.962
     6
                   58        107      17.5      24.60   72     163       372.8      374.17      9      16       2.622          3.133
     8
                   92        173       196      214.0   X       X            X           X      11     20       33.56          34.5
    10
                    X         X         X           X   X       X            X           X      13     24       534.9          536.4
    12
                    X         X         X           X   X       X            X           X      X       X        X              X
    13


USI-CMU summer school 2007                               Natasha Sharygina                                                       13
Concurrent Software
   Components synchronize on shared actions
          proceed independently on local actions


   Propositions of components are disjoint (no shared
   variables)




USI-CMU summer school 2007     Natasha Sharygina        14
Operational Semantics


                             a                 a
               M1 → M1’               M 2 → M2 ’            Synchronization on
                                 a                            Shared action
             (M1 || M2) → (M1’ || M2’)

                 a
               M1→ M1’               a ∉ Σ (M2)               Asynchronous
                        a                                       Execution
             (M1 || M2) → (M1’ || M2)

USI-CMU summer school 2007              Natasha Sharygina                    15
Operational Semantics
State of M1 || M2 is of the form (s1,s2) where si is a state of Mi




                a                                                         a
         s1             s’1       a ∉ Σ( M2)                     s2           s’2   a ∉ Σ( M1)
                              a                                                     a
               (s1,s2)                 (s’1,s2)                       (s1,s2)           (s1,s’2)

                                       a                              a
                                  s1       s’1             s2                 s’2
                                                  a
                                       (s1,s2)           (s’1,s’2)

       State-space exponential in # of components
USI-CMU summer school 2007                        Natasha Sharygina                                16
Example

                                               d                                                           d

               a               b        c                                    a          b’            c
       1                 2          3          4                       1’          2’        3’           4’

           M1 Σ = {a,b,c,d}                                             M2 Σ = {a,b’,c,d}
                                                                                                  d
                                            b              3,2’             b’
                                    a                                                   c
                             1,1’       2,2’                                     3,3’        4,4’
                                               b’          2,3’             b

                                                    M1 k M2
USI-CMU summer school 2007                         Natasha Sharygina                                       17
Compositional Verification

                               ☺
C Program                   Predicate                  Model                   SE-LTL       Yes
Abstraction                Abstraction                                       Verification
                                                                                            System OK
 Guidance                                     Counter                       No
                                              Example
                                Improved      Guided                             Counterexample
                               Abstraction
                                Guidance
                                              Abstraction
                                              Refinement
                                  ☺                                                ☺
                          Abstraction                                No   Counterexample    Yes
                          Refinement                                          Valid?
                                                Spurious
                                             Counterexample

  USI-CMU summer school 2007                     Natasha Sharygina                                18
Case Studies
   MicroC/OS-II
     Real-time OS for embedded applications
     Widely used (cell phones, medical devices,
     routers, washing machines…)
     6000+ LOC
     Verified locking discipline
                 Locks and Unlocks alternate and locks are eventually
                 released
          Found four bugs
                 Missing unlock and return (three known – one unknown)




USI-CMU summer school 2007            Natasha Sharygina                  19
Results

   Name              St-B    Tr-B   St-Mdl       T-BA            T-Mdl   T-Ver   T-Tot   Mem

      SS               25    47     7951         0.690           48.8    6.84    56.9    39.3

      SE               20    45     4331         0.497           18.8    2.92    22.8    24.2

      SS               25    47     7574         0.699           43.6    1.65    46.4    38.1

      SE               18    40     3691         0.407           15.3    1.089   17.3    21.2

      SS               25    47     24.8 M       0.874           65.6     X       X      851

      SE               20    45     13.6M        0.655           33.1    2.17    2207    162

      SS               25    47     32.6M        0.836           66.0     X       X      347

      SE               18    40     15.9M        0.713           34.6    4149    4185    321

    BUG                 8    14      873         0.205           3.41    0.261   3.88     X



USI-CMU summer school 2007                   Natasha Sharygina                                20
Case Studies
   IPC Module
      Deployed by a world leader in robotics engineering systems
      1500+ LOC
      4 components
      Over 30 billion states after predicate abstraction


   Discovered synchronization bug in a matter of hours
      Process can incorrectly block while writing to a queue
      Undetected despite seven years of testing/industrial use




USI-CMU summer school 2007    Natasha Sharygina                    21
Summary of the Approach
   State/Event-based modeling and specification


   Efficient (direct) model checking algorithm


   CEGAR loop for software systems
     Safety and liveness properties


   Compositional software verification
     Component-wise abstractions
     Component-wise counterexample validation
     Component-wise refinements




USI-CMU summer school 2007     Natasha Sharygina   22
References
    Sagar Chaki, Edmund M. Clarke, Joël Ouaknine,
    Natasha Sharygina: Concurrent software verification
    with states, events, and deadlocks. Formal Aspects
    of Computing 17(4): 461-483 (2005)


    Chiara Braghin, Natasha Sharygina, Katerina Barone-
    Adesi: Automated Verification of Security Policies in
    Mobile Code, In Proc. of Integrated Formal Methods
    2007 conf., LNCS 4591:37 - 54 (2007)




USI-CMU summer school 2007   Natasha Sharygina          23

Weitere ähnliche Inhalte

Was ist angesagt?

Mean variance
Mean varianceMean variance
Mean variance
odkoo
 
CMA-ES with local meta-models
CMA-ES with local meta-modelsCMA-ES with local meta-models
CMA-ES with local meta-models
zyedb
 
626 pages
626 pages626 pages
626 pages
JFG407
 
Tutorial solutions 2010
Tutorial solutions 2010Tutorial solutions 2010
Tutorial solutions 2010
Sufi Sulaiman
 
4831603 physics-formula-list-form-4
4831603 physics-formula-list-form-44831603 physics-formula-list-form-4
4831603 physics-formula-list-form-4
hongtee82
 
Hidden Markov Models
Hidden Markov ModelsHidden Markov Models
Hidden Markov Models
guestfee8698
 
Peer instructions questions for basic quantum mechanics
Peer instructions questions for basic quantum mechanicsPeer instructions questions for basic quantum mechanics
Peer instructions questions for basic quantum mechanics
molmodbasics
 
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
grssieee
 
L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)
sairoopareddy
 
Tele4653 l8
Tele4653 l8Tele4653 l8
Tele4653 l8
Vin Voro
 

Was ist angesagt? (19)

Mean variance
Mean varianceMean variance
Mean variance
 
CMA-ES with local meta-models
CMA-ES with local meta-modelsCMA-ES with local meta-models
CMA-ES with local meta-models
 
626 pages
626 pages626 pages
626 pages
 
SSA slides
SSA slidesSSA slides
SSA slides
 
Tutorial solutions 2010
Tutorial solutions 2010Tutorial solutions 2010
Tutorial solutions 2010
 
4831603 physics-formula-list-form-4
4831603 physics-formula-list-form-44831603 physics-formula-list-form-4
4831603 physics-formula-list-form-4
 
F. Quevedo, On Local String Models and Moduli Stabilisation
F. Quevedo, On Local String Models and Moduli StabilisationF. Quevedo, On Local String Models and Moduli Stabilisation
F. Quevedo, On Local String Models and Moduli Stabilisation
 
Hidden Markov Models
Hidden Markov ModelsHidden Markov Models
Hidden Markov Models
 
Physics formula list
Physics formula listPhysics formula list
Physics formula list
 
Analisi numerica di problemi di ingegneria strutturale
Analisi numerica di problemi di ingegneria strutturaleAnalisi numerica di problemi di ingegneria strutturale
Analisi numerica di problemi di ingegneria strutturale
 
Peer instructions questions for basic quantum mechanics
Peer instructions questions for basic quantum mechanicsPeer instructions questions for basic quantum mechanics
Peer instructions questions for basic quantum mechanics
 
Iskmaa
IskmaaIskmaa
Iskmaa
 
Hw6sols
Hw6solsHw6sols
Hw6sols
 
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
ANISOTROPIC SURFACES DETECTION USING INTENSITY MAPS ACQUIRED BY AN AIRBORNE L...
 
L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)L 32(nkd)(et) ((ee)nptel)
L 32(nkd)(et) ((ee)nptel)
 
Introduction to (weak) wave turbulence
Introduction to (weak) wave turbulenceIntroduction to (weak) wave turbulence
Introduction to (weak) wave turbulence
 
Simulation of Magnetically Confined Plasma for Etch Applications
Simulation of Magnetically Confined Plasma for Etch ApplicationsSimulation of Magnetically Confined Plasma for Etch Applications
Simulation of Magnetically Confined Plasma for Etch Applications
 
Tele4653 l8
Tele4653 l8Tele4653 l8
Tele4653 l8
 
Polarons in bulk and near surfaces
Polarons in bulk and near surfacesPolarons in bulk and near surfaces
Polarons in bulk and near surfaces
 

Ähnlich wie 20080501 software verification_sharygina_lecture02

Pres110811
Pres110811Pres110811
Pres110811
shotlub
 
A study of the worst case ratio of a simple algorithm for simple assembly lin...
A study of the worst case ratio of a simple algorithm for simple assembly lin...A study of the worst case ratio of a simple algorithm for simple assembly lin...
A study of the worst case ratio of a simple algorithm for simple assembly lin...
narmo
 
Nanomagnetism, Javier Tejada
Nanomagnetism, Javier TejadaNanomagnetism, Javier Tejada
Nanomagnetism, Javier Tejada
oriolespinal
 
Cluster aggregation with complete collisional fragmentation
Cluster aggregation with complete collisional fragmentationCluster aggregation with complete collisional fragmentation
Cluster aggregation with complete collisional fragmentation
Colm Connaughton
 
Cluster-cluster aggregation with (complete) collisional fragmentation
Cluster-cluster aggregation with (complete) collisional fragmentationCluster-cluster aggregation with (complete) collisional fragmentation
Cluster-cluster aggregation with (complete) collisional fragmentation
Colm Connaughton
 
Prévision de consommation électrique avec adaptive GAM
Prévision de consommation électrique avec adaptive GAMPrévision de consommation électrique avec adaptive GAM
Prévision de consommation électrique avec adaptive GAM
Cdiscount
 
Parametric time domain system identification of a mass spring-damper
Parametric time domain system identification of a mass spring-damperParametric time domain system identification of a mass spring-damper
Parametric time domain system identification of a mass spring-damper
MidoOoz
 

Ähnlich wie 20080501 software verification_sharygina_lecture02 (20)

What happens when the Kolmogorov-Zakharov spectrum is nonlocal?
What happens when the Kolmogorov-Zakharov spectrum is nonlocal?What happens when the Kolmogorov-Zakharov spectrum is nonlocal?
What happens when the Kolmogorov-Zakharov spectrum is nonlocal?
 
Fluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregationFluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregation
 
Pres110811
Pres110811Pres110811
Pres110811
 
Slides SAS'2002
Slides SAS'2002Slides SAS'2002
Slides SAS'2002
 
A study of the worst case ratio of a simple algorithm for simple assembly lin...
A study of the worst case ratio of a simple algorithm for simple assembly lin...A study of the worst case ratio of a simple algorithm for simple assembly lin...
A study of the worst case ratio of a simple algorithm for simple assembly lin...
 
Nanomagnetism, Javier Tejada
Nanomagnetism, Javier TejadaNanomagnetism, Javier Tejada
Nanomagnetism, Javier Tejada
 
論文紹介:Towards Robust Adaptive Object Detection Under Noisy Annotations
論文紹介:Towards Robust Adaptive Object Detection Under Noisy Annotations論文紹介:Towards Robust Adaptive Object Detection Under Noisy Annotations
論文紹介:Towards Robust Adaptive Object Detection Under Noisy Annotations
 
Jere Koskela slides
Jere Koskela slidesJere Koskela slides
Jere Koskela slides
 
Testing the Stability of GPS Oscillators within Serbian Permanent GPS Station...
Testing the Stability of GPS Oscillators within Serbian Permanent GPS Station...Testing the Stability of GPS Oscillators within Serbian Permanent GPS Station...
Testing the Stability of GPS Oscillators within Serbian Permanent GPS Station...
 
Cluster aggregation with complete collisional fragmentation
Cluster aggregation with complete collisional fragmentationCluster aggregation with complete collisional fragmentation
Cluster aggregation with complete collisional fragmentation
 
G. Martinelli - From the Standard Model to Dark Matter and beyond: Symmetries...
G. Martinelli - From the Standard Model to Dark Matter and beyond: Symmetries...G. Martinelli - From the Standard Model to Dark Matter and beyond: Symmetries...
G. Martinelli - From the Standard Model to Dark Matter and beyond: Symmetries...
 
Iit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationIit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY Trajectoryeducation
 
Cluster-cluster aggregation with (complete) collisional fragmentation
Cluster-cluster aggregation with (complete) collisional fragmentationCluster-cluster aggregation with (complete) collisional fragmentation
Cluster-cluster aggregation with (complete) collisional fragmentation
 
Prévision de consommation électrique avec adaptive GAM
Prévision de consommation électrique avec adaptive GAMPrévision de consommation électrique avec adaptive GAM
Prévision de consommation électrique avec adaptive GAM
 
Parametric time domain system identification of a mass spring-damper
Parametric time domain system identification of a mass spring-damperParametric time domain system identification of a mass spring-damper
Parametric time domain system identification of a mass spring-damper
 
Mit2 092 f09_lec06
Mit2 092 f09_lec06Mit2 092 f09_lec06
Mit2 092 f09_lec06
 
Tutorial no. 2
Tutorial no. 2Tutorial no. 2
Tutorial no. 2
 
Shailaja
ShailajaShailaja
Shailaja
 
Lecture6 svdd
Lecture6 svddLecture6 svdd
Lecture6 svdd
 
Quickselect Under Yaroslavskiy's Dual Pivoting Algorithm
Quickselect Under Yaroslavskiy's Dual Pivoting AlgorithmQuickselect Under Yaroslavskiy's Dual Pivoting Algorithm
Quickselect Under Yaroslavskiy's Dual Pivoting Algorithm
 

Mehr von Computer Science Club

20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
Computer Science Club
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs
Computer Science Club
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
Computer Science Club
 
20140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture1220140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture12
Computer Science Club
 
20140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture1120140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture11
Computer Science Club
 
20140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture1020140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture10
Computer Science Club
 
20140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture0920140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture09
Computer Science Club
 
20140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture0220140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture02
Computer Science Club
 
20140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture0120140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture01
Computer Science Club
 
20140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-0420140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-04
Computer Science Club
 
20140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture0120140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture01
Computer Science Club
 

Mehr von Computer Science Club (20)

20141223 kuznetsov distributed
20141223 kuznetsov distributed20141223 kuznetsov distributed
20141223 kuznetsov distributed
 
Computer Vision
Computer VisionComputer Vision
Computer Vision
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs
 
20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs20140531 serebryany lecture01_fantastic_cpp_bugs
20140531 serebryany lecture01_fantastic_cpp_bugs
 
20140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture1220140511 parallel programming_kalishenko_lecture12
20140511 parallel programming_kalishenko_lecture12
 
20140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture1120140427 parallel programming_zlobin_lecture11
20140427 parallel programming_zlobin_lecture11
 
20140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture1020140420 parallel programming_kalishenko_lecture10
20140420 parallel programming_kalishenko_lecture10
 
20140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture0920140413 parallel programming_kalishenko_lecture09
20140413 parallel programming_kalishenko_lecture09
 
20140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture0220140329 graph drawing_dainiak_lecture02
20140329 graph drawing_dainiak_lecture02
 
20140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture0120140329 graph drawing_dainiak_lecture01
20140329 graph drawing_dainiak_lecture01
 
20140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-0420140310 parallel programming_kalishenko_lecture03-04
20140310 parallel programming_kalishenko_lecture03-04
 
20140223-SuffixTrees-lecture01-03
20140223-SuffixTrees-lecture01-0320140223-SuffixTrees-lecture01-03
20140223-SuffixTrees-lecture01-03
 
20140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture0120140216 parallel programming_kalishenko_lecture01
20140216 parallel programming_kalishenko_lecture01
 
20131106 h10 lecture6_matiyasevich
20131106 h10 lecture6_matiyasevich20131106 h10 lecture6_matiyasevich
20131106 h10 lecture6_matiyasevich
 
20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich
 
20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich20131027 h10 lecture5_matiyasevich
20131027 h10 lecture5_matiyasevich
 
20131013 h10 lecture4_matiyasevich
20131013 h10 lecture4_matiyasevich20131013 h10 lecture4_matiyasevich
20131013 h10 lecture4_matiyasevich
 
20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich
 
20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich20131006 h10 lecture3_matiyasevich
20131006 h10 lecture3_matiyasevich
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

20080501 software verification_sharygina_lecture02

  • 1. Software Verification: State-Event-based Reasoning and Deadlock Detection Natasha Sharygina Joint work with Sagar Chaki, Ed Clarke, Joel Ouaknine USI-CMU summer school 2007 Natasha Sharygina
  • 2. Objectives C program verification Sequential and concurrent Properties involve both data (states) and communication (events) Specified as (State/Event) LTL formulas Safety and Liveness Communication via shared actions Synchronous communication Asynchronous execution USI-CMU summer school 2007 Natasha Sharygina 2
  • 3. Bluetooth L2CAP Spec “When an L2CAP_ConnectRsp event is received in a W4_L2CAP_CONNECT_RSP state, an L2CAP process may send out an L2CA_ConnectInd event, disable the RTX timer, and move to state CONFIG.” … Spec involves both states and events USI-CMU summer school 2007 Natasha Sharygina 3
  • 4. Labelled Kripke Structures Directed graph with labels on edges and states, (S,Init,P,L,T,Σ,E) Every state is labeled with a set of atomic propositions, P, true in the state 0,1 Every LKS comes with an alphabet of actions, Σ a a b 1,1 1,0 b c State labeling function : L: S 2P 0,0 Transition labeling function : E : T (2Σ {}) Assumption: LKSs are deadlock-free [see deadlock detection algorithm, later in this lecture] USI-CMU summer school 2007 Natasha Sharygina 4
  • 5. Traces and Languages Trace: infinite alternating sequence of states and actions (s1 a s2 b s4 b s1…) s1 a a b s2 s3 Language: set of all traces b c L(M) = {s1 a (s2 b + s3 c) s4 b}ω s4 M USI-CMU summer school 2007 Natasha Sharygina 5
  • 6. Surge Protector : State/Event m2 m1 c0 c1 m1 m2 m2 m0 c0 c0 m=0 m=1 m=2 c1 m0 m1 c2 m0 State/Event model of the Surge Protector (example is given for m: [0..2], c: [0..2]) USI-CMU summer school 2007 Natasha Sharygina 6
  • 7. Surge Protector : State Only m=0 m=1 m=2 c=0 c=0 c=0 m=0 m=1 m=2 c=1 c=1 c=1 m=0 m=1 m=2 c=2 c=2 c=2 Kripke structure of the Surge Protector (example is given for m: [0..2], c: [0..2]) USI-CMU summer school 2007 Natasha Sharygina 7
  • 8. State/Event LTL Given LKS M = (S,Init,P,L,T,Σ,E), and p ∈ P, a ∈ Σ, ϕ ::= p | a | ~ϕ | ϕ & ϕ | Xϕ | Gϕ | Fϕ | ϕ Uϕ π = (s1 a1 s2 a2 …) is a path and πi is the suffix of π starting at state si π╞ p iff s1 is the first state of π and p ∈ L(s1) π╞ a iff a is the first action of π π╞ ∼ϕ iff ∼(π╞ ϕ) π╞ Xϕ iff π2╞ ϕ π╞ ϕ1 U ϕ2 iff there is some i ≥ 1 such that πi╞ ϕ2 and for all 1 ≥ j ≥ i - 1, πj╞ ϕ1 M╞ ϕ iff, for every path π ∈ L(M), π╞ ϕ USI-CMU summer school 2007 Natasha Sharygina 8
  • 9. Surge Spec : State/Event m2 m1 c0 c1 m1 m2 m2 m0 c0 c0 m=0 m=1 m=2 c1 m0 m1 c2 m0 G ((c2 → m=2) & (c1 → (m=1 V m=2))) USI-CMU summer school 2007 Natasha Sharygina 9
  • 10. Surge Spec : State Only m=0 m=1 m=2 c=0 c=0 c=0 m=0 m=1 m=2 c=1 c=1 c=1 m=0 m=1 m=2 c=2 c=2 c=2 G (((c=0 V c=2) & X (c=1)) → (m=1 V m=2)) & G (((c=0 V c=1) & X (c=2)) → m=2) USI-CMU summer school 2007 Natasha Sharygina 10
  • 11. Surge Protector Verification • Changes of current beyond threshold are disallowed • State/Event Formula: G ((c2 → m=2) & (c1 → (m=1 V m=2))) • State Formula: G (((c=0 V c=2) & X (c=1)) → (m=1 V m=2)) & G (((c=0 V c=1) & X (c=2)) → m=2) • Event Formula: G (m0 → ((∼c1 W (m1 V m2) ) ) & G (m0 → ((∼c2 W m2)) & G (m1 → ((∼c2 W m2)) USI-CMU summer school 2007 Natasha Sharygina 11
  • 12. Automata-based Verification Given: M – LKS over Σ, P ϕ – SE/LTL formula How to check: M╞ ϕ Possible Approach: 1. Convert M into a conventional state-only Kripke structure 2. Convert ϕ into a state-only LTL formula 3. Check whether M╞ ϕ Inefficient! What we do: 1. Interpret ϕ as an LTL formula over Σ U P 2. Compute B~ϕ (using Wring [Somenzi, Bloem’00]) 3. Construct M ⊗ B~ϕ (result is a Buchi automaton) 4. Theorem: We have L (M ⊗ B~ϕ ) = {} iff M╞ ϕ No extra cost in time or space! USI-CMU summer school 2007 Natasha Sharygina 12
  • 13. Verification Results Current State Formula Event Formula State/Event Formula range Aut. Size Time Aut. Size Time Aut. Size Time St Tr BC MC St Tr BC MC St Tr BC MC 4 5 0.25 0.383 6 10 0.245 0.32 3 4 0.184 0.252 2 14 23 0.49 1.141 20 41 1.597 1.77 5 8 0.243 0.391 4 32 57 2.43 4.818 42 92 12.08 12.66 7 12 0.614 0.962 6 58 107 17.5 24.60 72 163 372.8 374.17 9 16 2.622 3.133 8 92 173 196 214.0 X X X X 11 20 33.56 34.5 10 X X X X X X X X 13 24 534.9 536.4 12 X X X X X X X X X X X X 13 USI-CMU summer school 2007 Natasha Sharygina 13
  • 14. Concurrent Software Components synchronize on shared actions proceed independently on local actions Propositions of components are disjoint (no shared variables) USI-CMU summer school 2007 Natasha Sharygina 14
  • 15. Operational Semantics a a M1 → M1’ M 2 → M2 ’ Synchronization on a Shared action (M1 || M2) → (M1’ || M2’) a M1→ M1’ a ∉ Σ (M2) Asynchronous a Execution (M1 || M2) → (M1’ || M2) USI-CMU summer school 2007 Natasha Sharygina 15
  • 16. Operational Semantics State of M1 || M2 is of the form (s1,s2) where si is a state of Mi a a s1 s’1 a ∉ Σ( M2) s2 s’2 a ∉ Σ( M1) a a (s1,s2) (s’1,s2) (s1,s2) (s1,s’2) a a s1 s’1 s2 s’2 a (s1,s2) (s’1,s’2) State-space exponential in # of components USI-CMU summer school 2007 Natasha Sharygina 16
  • 17. Example d d a b c a b’ c 1 2 3 4 1’ 2’ 3’ 4’ M1 Σ = {a,b,c,d} M2 Σ = {a,b’,c,d} d b 3,2’ b’ a c 1,1’ 2,2’ 3,3’ 4,4’ b’ 2,3’ b M1 k M2 USI-CMU summer school 2007 Natasha Sharygina 17
  • 18. Compositional Verification ☺ C Program Predicate Model SE-LTL Yes Abstraction Abstraction Verification System OK Guidance Counter No Example Improved Guided Counterexample Abstraction Guidance Abstraction Refinement ☺ ☺ Abstraction No Counterexample Yes Refinement Valid? Spurious Counterexample USI-CMU summer school 2007 Natasha Sharygina 18
  • 19. Case Studies MicroC/OS-II Real-time OS for embedded applications Widely used (cell phones, medical devices, routers, washing machines…) 6000+ LOC Verified locking discipline Locks and Unlocks alternate and locks are eventually released Found four bugs Missing unlock and return (three known – one unknown) USI-CMU summer school 2007 Natasha Sharygina 19
  • 20. Results Name St-B Tr-B St-Mdl T-BA T-Mdl T-Ver T-Tot Mem SS 25 47 7951 0.690 48.8 6.84 56.9 39.3 SE 20 45 4331 0.497 18.8 2.92 22.8 24.2 SS 25 47 7574 0.699 43.6 1.65 46.4 38.1 SE 18 40 3691 0.407 15.3 1.089 17.3 21.2 SS 25 47 24.8 M 0.874 65.6 X X 851 SE 20 45 13.6M 0.655 33.1 2.17 2207 162 SS 25 47 32.6M 0.836 66.0 X X 347 SE 18 40 15.9M 0.713 34.6 4149 4185 321 BUG 8 14 873 0.205 3.41 0.261 3.88 X USI-CMU summer school 2007 Natasha Sharygina 20
  • 21. Case Studies IPC Module Deployed by a world leader in robotics engineering systems 1500+ LOC 4 components Over 30 billion states after predicate abstraction Discovered synchronization bug in a matter of hours Process can incorrectly block while writing to a queue Undetected despite seven years of testing/industrial use USI-CMU summer school 2007 Natasha Sharygina 21
  • 22. Summary of the Approach State/Event-based modeling and specification Efficient (direct) model checking algorithm CEGAR loop for software systems Safety and liveness properties Compositional software verification Component-wise abstractions Component-wise counterexample validation Component-wise refinements USI-CMU summer school 2007 Natasha Sharygina 22
  • 23. References Sagar Chaki, Edmund M. Clarke, Joël Ouaknine, Natasha Sharygina: Concurrent software verification with states, events, and deadlocks. Formal Aspects of Computing 17(4): 461-483 (2005) Chiara Braghin, Natasha Sharygina, Katerina Barone- Adesi: Automated Verification of Security Policies in Mobile Code, In Proc. of Integrated Formal Methods 2007 conf., LNCS 4591:37 - 54 (2007) USI-CMU summer school 2007 Natasha Sharygina 23