Verification of Industry Code : Challenges R Venkatesh - - PowerPoint PPT Presentation

verification of industry code challenges
SMART_READER_LITE
LIVE PREVIEW

Verification of Industry Code : Challenges R Venkatesh - - PowerPoint PPT Presentation

Verification of Industry Code : Challenges R Venkatesh r.venky@tcs.com 1 Overview Focus of talk Scalability problems in industry code Ideas we are exploring Formal verification @ TRDDC Apply academic ideas to address


slide-1
SLIDE 1

Verification of Industry Code : Challenges

1

R Venkatesh r.venky@tcs.com

slide-2
SLIDE 2

Overview

Focus of talk

  • Scalability problems in industry code
  • Ideas we are exploring

Formal verification @ TRDDC

– Apply academic ideas to address quality related problems

  • Experiments and tools

– Adapt as required

2

– Adapt as required

  • Scale up
  • Specific solutions

Based on experiences with embedded software

slide-3
SLIDE 3

Context

Finding bugs early in software Model based development

– Matlab Simulink – Statecharts – Code

  • Generated and hand written

3

  • Generated and hand written

Analysis and Testing

– Most bugs can be found

slide-4
SLIDE 4

Experience

slide-5
SLIDE 5

Code Analysis

Standard + other properties – Zero division – Correct use of semaphores Dataflow analysis + model checking – Variable ranges from static

Model Code Static Anal

5

– Variable ranges from static analysis Precision is the key challenge – Model checking does not scale up

Error Report Model Checking

slide-6
SLIDE 6

Code Characteristics

Application Size Key Characteristics FPS(ZD) Infotainment 2MLOC (1 task) Large, large arrays(512), loops(unknown bounds) 77 Smart card component 7K Loops with large bounds and unknown bounds 55 Several Upto 36K

  • 6

j = nondet() * 2; for ( ; j < 512; j += 2) assert( j + 1 < 512);

36K

t = nondet_long(); while((t / sec_366) > 0) { if( y % 4) t -= sec_365; elset -= sec_366; y++ ; } … assert (m < 12 );

slide-7
SLIDE 7

Test Generation

  • Code coverage

– Modified Decision Condition Coverage

  • Very similar to property

checking

– Most states will be reachable – High coverage needed AutoGen C Code

7

– High coverage needed – False positives not an issue

  • Scaling up is the key challenge

Model checker Test Cases

slide-8
SLIDE 8

Code Characteristics

Driver assist + odometer cluster Generated code Recursive code Nested loops Counters + floating operations

while ( j++ <= 31 && !l)

8

while ( j++ <= 31 && !l) for (i = 0; i <= 31; i++) if (*) f(a[i]); l = i; while c(a[l], a[l + 1] ) l++; while ( *) recursion <counters>++; assert (counter < k );

slide-9
SLIDE 9

Current Ideas being Explored

slide-10
SLIDE 10

Loop Abstraction

  • Replace loops by small

bounded loops

  • One execution of body

– Each distinct path – Distinct output variable

  • Recurrence relations

while (*)

  • n = f(<io>);

for ( i in 1..n ) k = *;

10

  • Recurrence relations

– Linear

  • Naïve refinement

k = *; <io> = */recur(k);

  • n = f(<io>);
slide-11
SLIDE 11

Guessing Invariants : Daikon

Generate random traces Guess invariants – Daikon – Template based Replace complex code by

Invariant Gen C Code

11

Replace complex code by invariants Works well in practice

Test Gen Test Cases

slide-12
SLIDE 12

Statecharts Analysis

  • Size
  • Per statechart
  • ~ 5 states, ~ 6-7 transitions
  • Translates to ~200 lines of C

code

  • ~ 500 statecharts, composed in

parallel

  • Real valued clock variables, ~ 1-2 per

Statemate Models Dataport Abstraction Techniques

12

  • Real valued clock variables, ~ 1-2 per

statechart

  • Very long paths to reach some states
  • A fourth of the states did not reach in

depth 50

  • loops in each statechart

Translator to SAL Verification Driver (SAL-MCs) Simulation scripts for Counterexamples

slide-13
SLIDE 13

Summary

Success

– Scales up well to several thousand lines – Found several bugs

  • Production code
  • Medical, smart card, auto …

Limitations

– Scalability

  • ECUs of millions of lines of code

13

  • ECUs of millions of lines of code
  • Financial software much bigger

– Distributed systems

  • Multiple ECUs
  • Need order of magnitude scale up

– Compositional, heuristics