systema cally exploring control programs lecture i
play

Systema(cally exploring control programs (Lecture I) - PowerPoint PPT Presentation

Systema(cally exploring control programs (Lecture I) Ratul Mahajan Microso' Research Joint work with Jason Cro3, Ma5 Caesar, and Madan Musuvathi


  1. Systema(cally ¡exploring ¡ ¡ control ¡programs ¡(Lecture ¡I) ¡ Ratul ¡Mahajan ¡ Microso' ¡Research ¡ ¡ ¡ Joint ¡work ¡with ¡Jason ¡Cro3, ¡ ¡ Ma5 ¡Caesar, ¡and ¡Madan ¡Musuvathi ¡

  2. Control ¡programs ¡are ¡everywhere ¡ From ¡the ¡smallest ¡of ¡networks ¡to ¡the ¡largest ¡

  3. Control ¡programs ¡are ¡everywhere ¡ From ¡the ¡smallest ¡of ¡networks ¡to ¡the ¡largest ¡

  4. The ¡nature ¡of ¡control ¡programs ¡ Collec>on ¡of ¡rules ¡with ¡triggers ¡and ¡ac>ons ¡ motionPorch.Detected: packetIn: if (Now - tLastMotion < 1s entry = new Entry(inPkt.src, && lightLevel < 20) inPkt.dst) porchLight.Set(On) if (!cache.Contains(entry) tLastMotion = Now cache.Insert(entry, Now) @6:00:00 PM: CleanupTimer: porchLight.Set(On) foreach entry in cache @6:00:00 AM: if (Now – cache[entry] < 5s) porchLight.Set(Off) cache.Remove(entry)

  5. Buggy ¡control ¡programs ¡wreak ¡havoc ¡ One ¡nice ¡morning ¡in ¡ the ¡summer ¡

  6. Buggy ¡control ¡programs ¡wreak ¡havoc ¡ “I ¡had ¡a ¡rule ¡that ¡would ¡turn ¡on ¡the ¡heat, ¡disarm ¡the ¡ alarm, ¡turn ¡on ¡some ¡lights, ¡etc. ¡at ¡8am ¡….. ¡ I ¡came ¡home ¡from ¡vaca>on ¡to ¡find ¡a ¡warm, ¡invi>ng, ¡ insecure, ¡well ¡lit ¡house ¡that ¡had ¡been ¡that ¡way ¡for ¡a ¡ week…… ¡ ¡ That’s ¡just ¡one ¡example, ¡but ¡the ¡point ¡is ¡that ¡it ¡has ¡ taken ¡me ¡literally ¡YEARS ¡of ¡these ¡types ¡of ¡mistakes ¡to ¡ iron ¡out ¡all ¡the ¡kinks.” ¡

  7. Control ¡programs ¡are ¡hard ¡to ¡reason ¡about ¡ motionPorch.Detected: if (Now - timeLastMotion < 1 secs && lightMeter.Level < 20) Physical ¡ 9:00 ¡PM ¡ porchLight.Set(On); actua>on ¡ timeLastMotion = Now; 9:04 ¡PM ¡ Mo>on ¡ porchLight.StateChange: 9:05 ¡PM ¡ Lights ¡off ¡ if (porchLight.State == On) timerPorchLight.Reset(5 mins); timerPorchLight.Fired: if (Now.Hour > 6AM && Now.Hour < 6PM) porchLight.Set(Off); Rule ¡ ¡ Large ¡input ¡ Dependence ¡on ¡ interac(on ¡ space ¡ (me ¡

  8. Desirable ¡proper(es ¡for ¡bug ¡finders ¡ Sound ¡ Complete ¡ Fast ¡

  9. Two ¡bug ¡finding ¡methods ¡ Tes>ng ¡ Model ¡checking ¡

  10. Two ¡threads ¡in ¡model ¡checking ¡ Check ¡models ¡ Check ¡code ¡

  11. Model ¡checking ¡code ¡ ¡ FSM ¡is ¡the ¡most ¡popular ¡abstrac>on ¡

  12. Model ¡checking ¡code ¡ ¡ FSM ¡is ¡the ¡most ¡popular ¡abstac>on ¡

  13. Model ¡checking ¡code ¡ ¡ FSM ¡is ¡the ¡most ¡popular ¡abstrac>on ¡ – Decide ¡what ¡are ¡“states” ¡and ¡“transi>ons” ¡ ¡ S0 ¡ T2 ¡ T1 ¡ S1 ¡ S2 ¡ T2 ¡ T1 ¡ T2 ¡ T1 ¡ S3 ¡ S4 ¡

  14. Example ¡ [PorchLight, ¡Timer] ¡ motionPorch: porchLight.Set(On) [Off, ¡Off] ¡ timer.Start(5 mins) Mo>on ¡ LightOn ¡ Timer ¡ porchLight.On: [On, ¡On] ¡ timer.Start(5 mins) Mo>on ¡ LightOn ¡ timer.Fired: LightOff ¡ porchLight.Set(Off) LightOn ¡ [Off, ¡On] ¡ Timer ¡ Mo>on ¡

  15. Exploring ¡input ¡space ¡ motionPorch: if (lightLevel < 20) To ¡explore ¡comprehensively, ¡ porchLight.Set(On) must ¡consider ¡all ¡possible ¡ timer.Start(10 mins) values ¡of ¡input ¡parameters ¡ porchLight.On: timer.Start(5 mins) timer.Fired: porchLight.Set(Off) [PorchLight, ¡Timer] ¡ [PorchLight, ¡Timer] ¡ [Off, ¡Off] ¡ [Off, ¡Off] ¡ LtLvl=99 ¡ LtLvl=99 ¡ ¡ LtLvl=0 ¡ LtLvl=0 ¡ LtLvl=20 ¡ ● ¡● ¡● ¡ LtLvl=19 ¡ ● ¡● ¡● ¡ ● ¡ ¡ ¡● ¡ ¡ ¡● ¡ [Off, ¡Off] ¡ [On, ¡On] ¡ […] ¡ […] ¡

  16. Symbolic ¡execu(on ¡ (x,y,p) = ( ​𝜏↓𝑦 , ¡ ​ if (x < 2) 𝜏↓𝑧 , ¡ ​𝜏↓𝑞 ) if (y > 5) p = 1; ​𝜏↓𝑦 ​𝜏↓𝑦 else <2 ≥2 p = 2; ​𝜏↓𝑧 ​𝜏↓𝑧 ​𝜏↓𝑧 ​𝜏↓𝑧 else ​𝜏↓𝑦 ​𝜏↓𝑦 if (y > 10) ​𝜏↓𝑦 ​𝜏↓𝑦 >5 ≤5 >10 ≤10 p = 3; <2 ¡� ≥2� ≥2 � ≥2� else ​𝜏↓𝑧 ​𝜏↓𝑧 ​𝜏↓𝑧 ​𝜏↓𝑧 p = 4; >5 >10 ≤5 ​ ≤10� 𝜏↓𝑞 ​𝜏↓𝑞 ​𝜏↓𝑞 ​𝜏↓𝑞 =2 =4 =1 =3

  17. Finding ¡equivalent ¡inputs ¡using ¡ symbolic ¡execu(on ¡ 1. Symbolically ¡execute ¡each ¡trigger ¡ 2. Find ¡input ¡ranges ¡that ¡lead ¡to ¡same ¡ state ¡ ¡ motionPorch: LtLvl ¡ LtLvl ¡ if (lightMeter.level < 20) porchLight.Set(On) <20 ¡ ≥20 ¡ timer.Start(5 mins) porchLight.On: LtLvl =∗ ¡ timer.Start(5 mins) LtLvl =∗ ¡ timer.Fired: porchLight.Set(Off)

  18. Finding ¡equivalent ¡inputs ¡using ¡ symbolic ¡execu(on ¡ 1. Symbolically ¡execute ¡each ¡trigger ¡ 2. Find ¡input ¡ranges ¡that ¡lead ¡to ¡same ¡ state ¡ ¡ motionPorch: LtLvl =9 x = lightMeter.Level LtLvl =0 ¡ • • • • 9 ¡ porchLight.On: timer.Start(5 mins) timer.Fired: porchLight.Set(Off)

  19. Efficiently ¡exploring ¡the ¡input ¡space ¡ Pick ¡random ¡values ¡in ¡equivalent ¡classes ¡ motionPorch: LtLvl ¡ LtLvl ¡ if (lightMeter.level < 20) porchLight.Set(On) <20 ¡ ≥20 ¡ timer.Start(5 mins) porchLight.On: [Off, ¡Off] ¡ Mo>on, ¡ Mo>on, ¡ timer.Start(5 mins) LtLvl ¡=10 ¡ LtLvl ¡= ¡20 ¡ timer.Fired: [Off, ¡Off] ¡ [On, ¡On] ¡ porchLight.Set(Off)

  20. Use ¡symbolic ¡execu(on ¡alone? ¡ Symbolic, ¡path-­‑based ¡ Concrete, ¡state-­‑based ¡ Trigger0, ¡ [] ¡ [] ¡ Trigger1, ¡ Trigger0 ¡ Trigger2 ¡ Trigger1 ¡ Trigger2 ¡

  21. Exploring ¡temporal ¡behavior: ¡ soundness ¡ [PorchLight, ¡TimerDim, ¡TimerOff] ¡ motionPorch: porchLight.Set(On) [Off, ¡Off, ¡Off] ¡ LightOff ¡ timerDim.Start(5 mins) Mo>on ¡ timerOff.Start(10 mins) LightOn ¡ porchLight.On: Mo>on ¡ timerDim.Start(5 mins) [On, ¡On, ¡On] ¡ LightOn ¡ timerOff.Start(10 mins) LightOff ¡ TimerOff ¡ timerDim.Fired: TimerDim ¡ porchLight.Set(Dim) [Off, ¡On, ¡On] ¡ [Dim, ¡Off, ¡On] ¡ [Off, ¡On, ¡Off] ¡ timerOff.Fired: porchLight.Set(Off) if timerDim.On() Abort();

  22. Exploring ¡temporal ¡behavior: ¡ completeness ¡ motionPorch: if (Now - tLastMotion < 60) porchLight.Set(On) timer.Start(600) To ¡explore ¡comprehensively, ¡ tLastMotion = Now must ¡fire ¡all ¡possible ¡events ¡ porchLight.On: at ¡all ¡possible ¡>mes ¡ timer.Start(600) timer.Fired: porchLight.Set(Off)

  23. Trigger0: [trigger1Seen, ¡tTrigger1, ¡tTrigger2] ¡ tTrigger1 = Now tTrigger2 = Now [false, ¡T, ¡T] ¡ trigger1Seen = false Trigger1 ¡ Trigger1 ¡ [Now=T+3] ¡ [Now=T+6] ¡ Trigger1: if (Now – tTrigger1 < 5) [true, ¡T+3, ¡T] ¡ [false, ¡T+6, ¡T] ¡ trigger1Seen = true tTrigger1 = Now Trigger2 ¡ Trigger2: if (trigger1Seen) if (Now – tTrigger2 < 2) DoSomething() ¡ DoSomethingElse() ¡ DoSomething() else DoSomethingElse()

  24. Trigger0: [trigger1Seen, ¡tTrigger1, ¡tTrigger2] ¡ tTrigger1 = Now tTrigger2 = Now [false, ¡T, ¡T] ¡ trigger1Seen = false Trigger1 ¡ Trigger1 ¡ [Now=T+1] ¡ [Now=T+6] ¡ Trigger1: if (Now – tTrigger1 < 5) [true, ¡T+1, ¡T] ¡ [false, ¡T+6, ¡T] ¡ trigger1Seen = true tTrigger1 = Now Trigger2 ¡ Trigger2: if (trigger1Seen) if (Now – tTrigger2 < 2) DoSomething() ¡ DoSomethingElse() ¡ DoSomething() else DoSomethingElse()

  25. The ¡tyranny ¡of ¡“all ¡possible ¡(mes” ¡ Completeness ¡ Speed ¡

  26. Timed ¡automata ¡ FSM ¡(states, ¡transi>ons) ¡+ ¡the ¡following: ¡ ¡ ¡ • Finite ¡number ¡of ¡real-­‑values ¡clocks ¡(VCs) ¡ • All ¡VCs ¡progress ¡at ¡the ¡same ¡rate, ¡except ¡that ¡ one ¡or ¡more ¡VCs ¡may ¡reset ¡on ¡a ¡transi>on ¡ • VC ¡constraints ¡gate ¡transi>ons ¡

  27. Trigger0: Trigger0 ¡ [trigger1Seen] ¡ tTrigger1 = Now () ¡[x1,x2] ¡ tTrigger2 = Now Trigger1 ¡ [false] ¡ (x1 ¡>=5) ¡[x1] ¡ trigger1Seen = false Trigger1: Trigger2 ¡ () ¡[] ¡ if (Now – tTrigger1 < 5) Trigger1 ¡ Trigger0 ¡ ¡ trigger1Seen = true (x1<5) ¡[x1] ¡ () ¡[x1,x2] ¡ tTrigger1 = Now Trigger1 ¡ ¡ Trigger2: (x1 ¡>= ¡5) ¡[x1] ¡ if (trigger1Seen) if (Now – tTrigger2 < 2) [true] ¡ Trigger1 ¡ DoSomething() (x1 ¡< ¡5 ¡) ¡[x1] ¡ else Trigger2 ¡(x2 ¡>= ¡2) ¡ Trigger2 ¡(x2 ¡< ¡2) ¡ DoSomethingElse() [] ¡{DoSomethingElse} ¡ [] ¡{DoSomething} ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend