460 likes | 571 Views
The research explores guided search methodologies to improve the discovery of errors in software model checking. Traditional verification methods face challenges, including state explosion due to exponential behavior growth with every increment. The authors, Neha Rungta and Eric Mercer from Brigham Young University's Computer Science Department, investigate various techniques such as parallel model checking, predicate abstraction, and heuristics to efficiently identify counterexamples and minimize memory usage during the search process. This study offers insights into significantly enhancing software verification processes, addressing critical issues exemplified by real-world cases.
E N D
Improving Error Discovery using Guided Search Neha Rungta & Eric Mercer Computer Science Department Brigham Young University, Provo UT
Software Model Checking • Motivation • Ariane 5 • Comair debacle • Verifying Software Models • A transition graph for the model is created • A predefined property is verified ex. Reachability • Problem • Number of behaviors is exponential with every increment • This causes a state explosion problem Verification and Validation, CS Dept, BYU
Approaches • Traditional techniques to counter it • Parallel or Distributed Model Checking • Predicate Abstraction • Disk based Algorithm • Heuristics for Guided search • Heuristics • Find a counterexample before memory runs out • Property based heuristics • Structure based heuristics • Structure of program can be use to guide the search Verification and Validation, CS Dept, BYU
Current Structural heuristics • Stefan Edelkamp and Tilman Mehler • Finds a short and easy to understand Error trail • Minimal operations to reach g from s is FSM distance • This distance is admissible and consistent • Build control flow graph (CFG) with just PC values • Willem Visser and Alex Groce • Specific only to Java Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 Edelkamp’s FSM Heuristic: Shortest Distance from current state to checking for error in the CFG 05 error error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 Edelkamp’s FSM Heuristic: Shortest Distance from current state to checking for error in the CFG 05 error error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 Edelkamp’s FSM Heuristic: Shortest Distance from current state to checking for error in the CFG 05 error error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 Edelkamp’s FSM Heuristic: Shortest Distance from current state to checking for error in the CFG 05 error error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo foo 03 07 04 08 Edelkamp’s FSM Heuristic: Shortest Distance from current state to checking for error in the CFG 05 3 steps error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
Underestimation Example 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 error error error Verification and Validation, CS Dept, BYU
True Distance should be …. 01 main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts main 02 06 foo 03 07 04 08 05 8 steps error error error Verification and Validation, CS Dept, BYU
Solution: Interprocedural CFG • All the nodes in the ICFG that are part of a subroutine will be indexed on two things • PC Value • Return address to where the subroutine will return when it encounters a return statement Verification and Validation, CS Dept, BYU
01 (init) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts Verification and Validation, CS Dept, BYU
01 (init) 02 (init) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) 07 (03) 08 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts 03 (init) Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) 07 (03) 08 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts 03 (init) 04 (init) 06 (05) 07 (05) 08 (05) 05 (init) Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) 07 (03) 08 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts 03 (init) 04 (init) 06 (05) 07 (05) 08 (05) 05 (init) Verification and Validation, CS Dept, BYU
01 (init) 02 (init) 06 (03) 07 (03) 08 (03) main: 01: ldx #1 02: call foo 03: add x,1 04: call foo 05: check for error foo: 06: pshx 07: pulx 08: rts 03 (init) 04 (init) 06 (05) 07 (05) 08 (05) 05 (init) 8 steps Verification and Validation, CS Dept, BYU
Nested Function Calls x x f f g g • x → f → g • y → f → g • Same problem as before main 1:call x (init) 3:call f (2) 7:call g (4) 9 (8) f y 5:call g (error) 7:call g (6) a:rts (8) main: 1 call x 2 call y error f: 7 call g 8 rts 2:call y (init) 4:rts (2) 8:rts (4) x: 3 call f 4 rts y: 5 call f 6 rts g: 9 xyz a rts 6:rts (error) error 8:rts (6) Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Abstract states from the stack 0a (08) PC: 09 abstract states generated from the stack sa0 02 04 08 (04) 08 sa1 04 (02) sa2 02 (init) sa3 Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Marking returns statically foo prologue beq epilogue return Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm x x f f g g PC: 09 main 1:call x (init) 3:call f (2) 7:call g (4) 9 (8) 02 04 f y 08 5:call g (error) 7:call g (6) a:rts (8) Calculating the Heuristic: D = 0 FSM ((a,8),error) = 4 2:call y (init) 4:rts (2) 8:rts (4) 6:rts (error) error 8:rts (6) Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm x f g PC: 09 main 1:call x (init) 3:call f (2) 7:call g (4) 9 (8) 02 04 f y 08 5:call g (error) 7:call g (6) a:rts (8) Calculating the Heuristic: D = 0 FSM ((a,8),error) = 4 FSM ((a,8), (rts,8) = 1 1 < 4 D += 1 2:call y (init) 4:rts (2) 8:rts (4) 6:rts (error) error 8:rts (6) Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm ICFG_Algorithm(state S) sa0 = icfgState(S) <sa1,sa2,….,san> // are abstracted states in the call stack of S d = 0 for i = 0 to n do srtn = rtn(sai) if FSM(sai, error) < FSM(sai,srtn) then d = d + FSM(sai,error) return d d = d + FSM(sai, srtn) + 1 return d Verification and Validation, CS Dept, BYU
Improved ICFG Algorithm x f g PC: 0a main 1:call x (init) 3:call f (2) 7:call g (4) 9 (8) f y 5:call g (error) 7:call g (6) a:rts (8) D = 11 2:call y (init) 4:rts (2) 8:rts (4) 6:rts (error) error 8:rts (6) Verification and Validation, CS Dept, BYU
Results: Number of states generated Verification and Validation, CS Dept, BYU
Conclusions • Small overhead allowed use of more static information • The Dynamic call stack with static analysis gave a better estimate • Testing shows an significant improvement in FSM distance • The Improved ICFG algorithm can be used on any graph • The algorithm is admissible and consistent Verification and Validation, CS Dept, BYU
QUESTIONS Verification and Validation, CS Dept, BYU