big step bounded model checking
play

Big-Step Bounded Model Checking for So6ware Nishant Sinha , - PowerPoint PPT Presentation

Big-Step Bounded Model Checking for So6ware Nishant Sinha , IBM Research Labs Bangalore, India Example: NULL dereference N.foo . M.M T.T


  1. Big-­‑Step ¡Bounded ¡Model ¡Checking ¡ for ¡So6ware ¡ Nishant ¡Sinha , ¡ ¡ IBM ¡Research ¡Labs ¡ Bangalore, ¡India ¡ ¡

  2. Example: ¡NULL ¡dereference ¡

  3. N.foo ¡ .… ¡ M.M ¡ T.T ¡ M.makeList ¡ A.A ¡ M.makeBnds ¡ List.isEmpty ¡ A.init ¡ ArrayList.ArrayList ¡ List.add ¡ List.size ¡ List.addAll ¡

  4. Main ¡So6ware ¡VerificaMon ¡Paradigms ¡ AutomaMc ¡(largely) ¡ Manual ¡Pre-­‑Post ¡ AnnotaMons+ ¡ Constraint-­‑Solving ¡ Extended ¡StaMc ¡Checking ¡ ESC-­‑Java, ¡HAVOC, ¡.. ¡ Bounded ¡Model ¡Checking ¡ Abstract ¡ ¡ CEGAR ¡ InterpretaMon ¡ SPIN, ¡CBMC, ¡F-­‑so6, ¡DART, ¡.. ¡ ¡ SLAM, ¡BLAST, ¡ ASTREE, ¡Interproc, ¡.. ¡ SATABS, ¡.. ¡ Focused ¡on ¡Bug-­‑Finding ¡ Focused ¡on ¡Proofs ¡

  5. Automated ¡VerificaMon ¡Strategies ¡ Bounded ¡Model ¡ ¡ Abstract ¡ ¡ CEGAR ¡ Hardware ¡ Checking ¡ InterpretaMon ¡ VerificaMon ¡ • Very ¡expressive ¡ • Proofs ¡on ¡ • Proofs ¡on ¡finite ¡ • Search ¡explicitly/ proof ¡language ¡ potenMally ¡ state ¡space ¡ symbolically ¡on ¡ infinite ¡domains ¡ • No ¡generic ¡ • IteraMve ¡fact ¡ part/whole ¡ (integers) ¡ heurisMcs ¡to ¡ propagaMon ¡ obtain ¡fixpoints ¡ program ¡to ¡ ¡ ¡ ¡ ¡ ¡ • IteraMve ¡fact ¡ towards ¡a ¡fixpoint ¡ propagaMon ¡ • Instead, ¡finiMze ¡ (BDDs) ¡ find ¡bugs ¡ towards ¡a ¡ the ¡set ¡of ¡facts ¡ • Less ¡expressive ¡ • Relies ¡on ¡one ¡or ¡ fixpoint ¡ involved ¡in ¡ proof ¡language ¡ proofs ¡ more ¡“bounding ¡ • Less ¡expressive ¡ (proposiMonal ¡ proof ¡language ¡ • IteraMvely ¡build ¡ assumpMons” ¡ logic) ¡enables ¡exact ¡ spurious ¡proofs ¡ fixpoint ¡ • Allow ¡ • Proofs ¡are ¡an ¡ and ¡refine ¡them ¡ computaMon ¡ imprecision/ unMl ¡the ¡actual ¡ a6er-­‑thought, ¡ generalizaMon ¡of ¡ • Symbolic ¡search/ proof ¡is ¡obtained ¡ facts ¡as ¡long ¡as ¡ e.g., ¡by ¡learning ¡ simulaMon ¡for ¡ the ¡proof ¡ • Witnesses ¡are ¡an ¡ finding ¡witnesses ¡ from ¡search ¡ construcMon ¡ a6er-­‑thought ¡ using ¡saMsfiability ¡ failures ¡ does ¡not ¡fail ¡ solving ¡ ¡

  6. Bounded ¡Model ¡Checking ¡ • Biere, ¡Clarke ¡et ¡al. ¡’99, ¡originally ¡for ¡hardware ¡verif. ¡ • IniMal ¡states ¡I, ¡TransiMon ¡relaMon ¡R, ¡Error ¡E ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡I(s 0 ) ¡/\ ¡R 1 (s 0 ,s 1 ) ¡/\ ¡… ¡/\ ¡R n (s n-­‑1 ,s n ) ¡ ¡/\ ¡E(s n ) ¡ ¡ ¡ ¡ ¡ ¡Check ¡with ¡a ¡SAT/SMT ¡solver, ¡if ¡saMsfiable, ¡then ¡the ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡soluMon ¡(model) ¡maps ¡to ¡an ¡error ¡witness ¡ • Exploit ¡efficient ¡decision ¡procedures ¡for ¡first-­‑order ¡ logic, ¡Go ¡light ¡on ¡fixpoints ¡ • Monolithic ¡R ¡does ¡not ¡scale. ¡Need ¡parMMoned ¡R. ¡

  7. ParMMon ¡and ¡Compose ¡IteraMvely ¡ • Control/Data ¡flow ¡provides ¡a ¡natural ¡parMMon ¡ (FSM ¡style) ¡ ¡R k ¡ ¡ ¡ ≅ ! ¡(pc ¡= ¡k) ¡=> ¡(x' ¡= ¡x ¡+ ¡1 ¡/\ ¡pc' ¡= ¡k ¡+ ¡1) ¡ R ¡= ¡/\ ¡R k ¡ ¡ ¡ (SSA) ¡R 1 ¡ ¡ ≅ ! ¡(x 1 ¡= ¡x 0 ¡+ ¡1), ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R 2 ¡ ¡ ≅ ! ¡(x 3 ¡= ¡ite(p, ¡x 1 , ¡x 0 )) ¡ ¡ R ¡= ¡R 1 ¡/\ ¡R 2 ¡ • Compose ¡R k ¡to ¡simulate ¡one ¡or ¡more ¡program ¡paths ¡ • Check ¡saMsfiability ¡a6er ¡composiMon ¡to ¡ensure ¡feasibility ¡ • These ¡are ¡fine-­‑grained ¡parMMons ¡ ¡ – each ¡BMC ¡step ¡is ¡a ¡small-­‑step ¡

  8. IteraMve ¡Small-­‑Step ¡ComposiMon ¡ IniMal ¡State: ¡[x ¡-­‑> ¡x0, ¡y ¡-­‑> ¡y0 ¡] ¡ 1 ¡ x <= 0 x > 0 [x0 ¡<= ¡0, ¡x ¡-­‑> ¡x0, ¡..] ¡ [x0 ¡> ¡0, ¡x ¡-­‑> ¡x0] ¡ 2 ¡ 3 ¡ y := -x y := x 4 ¡ [true, ¡y-­‑>ite(x0>0, ¡x0, ¡-­‑x0) ¡] ¡

  9. Hierarchical ¡Program ¡Structure ¡ CC77c, ¡SP81, ¡RHS95 ¡ ¡ Call ¡Graph ¡ ComposiMon ¡of ¡Summaries ¡ 2 nd ¡ ¡order ¡ main ¡ Control ¡Flow ¡Graphs ¡ ComputaMon ¡of ¡Summaries ¡ 1 st ¡order ¡

  10. Small ¡Step ¡composiMon ¡is ¡Bad ¡ • If ¡we ¡do ¡only ¡small-­‑step ¡(or ¡primarily ¡small-­‑ step, ¡reuse ¡summaries) ¡ – ¡will ¡do ¡repeated ¡composiMons ¡(re-­‑analyze ¡ procedures ¡for ¡different ¡contexts) ¡ – ¡hard ¡to ¡prioriMze ¡between ¡composiMon ¡choices ¡ ¡ Backward ¡ x ¡> ¡5 ¡ Forward ¡ g ¡(x) ¡ y ¡= ¡x ¡+ ¡1 ¡ Goal ¡

  11. Scaling ¡up ¡BMC ¡ ¡ What ¡is ¡the ¡granularity ¡of ¡R k ¡? ¡Big-­‑step ¡ Which ¡state ¡do ¡you ¡start ¡with? ¡Goal ¡state ¡ How ¡to ¡choose ¡between ¡non-­‑determinisMc ¡ choice ¡of ¡composiMons? ¡Alternate ¡ ¡ ¡ ¡

  12. Alternate ¡and ¡Learn: ¡ ¡ Finding ¡Witnesses ¡without ¡Looking ¡All ¡Over ¡ Nishant ¡Sinha, ¡Nimit ¡Singhania, ¡ ¡ ¡ ¡ ¡ ¡ ¡ SaMsh ¡Chandra, ¡Manu ¡Sridharan ¡ ¡ IBM ¡Research ¡Labs ¡ India, ¡U.S.A. ¡ ¡ Computer-­‑Aided ¡VerificaMon, ¡2012 ¡

  13. Our ¡approach: ¡ALTER ¡ • ALTER : ¡Goal-­‑Driven ¡Big-­‑Step ¡ComposiMon ¡ ¡ – May ¡be ¡viewed ¡as ¡Scope ¡Expansion ¡around ¡ a ¡goal ¡procedure ¡ • Local, ¡One-­‑Time ¡Summaries ¡ • AlternaMng ¡ExploraMon ¡starMng ¡from ¡Goal ¡ • Learning ¡from ¡Failures ¡

  14. Example: ¡NULL ¡dereference ¡

  15. N.foo ¡ .… ¡ M.M ¡ T.T ¡ M.makeList ¡ A.A ¡ M.makeBnds ¡ List.isEmpty ¡ A.init ¡ ArrayList.ArrayList ¡ List.add ¡ List.size ¡ List.addAll ¡

  16. A ¡Local ¡Summary ¡ ¡ ¡ ¡<Side-­‑effects, ¡Call-­‑sites, ¡Error ¡CondiMons> ¡ • Abstract ¡away ¡caller ¡inputs ¡and ¡callee ¡side-­‑ effects ¡with ¡fresh ¡variables ¡(Skolems) ¡ • Then, ¡compute ¡a ¡local ¡summary ¡by ¡intra-­‑ KP05, ¡S08, ¡ CFS09 ¡ ¡ procedural ¡all-­‑path ¡symbolic ¡execuMon ¡ • Fully-­‑precise ¡modulo ¡caller ¡inputs ¡and ¡callee ¡ side-­‑effects ¡

  17. ¡Example: ¡Local ¡Summary ¡ bool ¡check ¡(T ¡t ¡) ¡{ ¡ bool ¡check ¡(T ¡t ¡) ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡ ¡(t ¡!= ¡null) ¡ ¡ ¡ ¡ ¡if ¡ ¡(t ¡!= ¡null) ¡ ¡ ¡return ¡t.f.validate(); ¡ ¡ ¡return ¡t.f.validate(); ¡ ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡else ¡ ¡ ¡return ¡false; ¡ ¡ ¡return ¡false; ¡ } ¡ ¡ } ¡ ¡ Call-­‑Site ¡ (t 0 ¡!= ¡null ¡, ¡t ¡ ¡ ¡ ¡ ¡t 0 ) ¡ (true, ¡ ¡ ¡ret ¡ ¡ ¡ ¡ ¡ ¡ite ¡(t 0 ¡!= ¡null, ¡sk validate ¡, ¡false) ¡) ¡ Side-­‑effect ¡ EC ¡ (t 0 ¡!= ¡null ¡/\ ¡t 0 .f ¡= ¡null) ¡ Computed ¡only ¡ONCE ¡for ¡each ¡procedure ¡! ¡

  18. ComposiMon ¡Strategies ¡ CC77c, ¡SP81, ¡RHS95 ¡ ¡ Call ¡Graph ¡ ComposiMon ¡of ¡Summaries ¡ G ¡ H ¡ main ¡ F ¡ Control ¡Flow ¡Graphs ¡ ComputaMon ¡of ¡Summaries ¡ 1 st ¡and ¡2 nd ¡order ¡composi=on ¡are ¡Intertwined ¡ Compose ¡with ¡G’s ¡summary ¡ ¡-­‑> ¡Compute ¡G’s ¡summary ¡-­‑> ¡Compose ¡H ¡-­‑> ¡Compute ¡H ¡… ¡ ¡

  19. Big-­‑step ¡ComposiMon ¡Strategies ¡ • Bowom-­‑up ¡composiMon ¡ – Many ¡irrelevant ¡callees ¡composed ¡(e.g., ¡large ¡number ¡of ¡ irrelevant ¡virtual ¡calls) ¡ CC77c, ¡SP81, ¡RHS95 ¡ ¡ • Top-­‑down ¡composiMon ¡ – Many ¡irrelevant ¡callers ¡composed ¡if ¡goal ¡is ¡deep ¡ • None ¡saMsfactory, ¡both ¡perform ¡eager, ¡possibly ¡ irrelevant ¡composiMons ¡ • Need ¡a ¡lazier, ¡focused ¡strategy ¡

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