Automatically Discovering Abstractions for Network Verification - - PowerPoint PPT Presentation

automatically discovering abstractions for network
SMART_READER_LITE
LIVE PREVIEW

Automatically Discovering Abstractions for Network Verification - - PowerPoint PPT Presentation

Automatically Discovering Abstractions for Network Verification Devon Loehr 1 Networks are buggy, and that doesnt surprise you 2 Networks are buggy, and that doesnt surprise you 3 Networks are buggy, and that doesnt surprise you 4


slide-1
SLIDE 1

Automatically Discovering Abstractions for Network Verification

Devon Loehr

1

slide-2
SLIDE 2

Networks are buggy, and that doesn’t surprise you

2

slide-3
SLIDE 3

Networks are buggy, and that doesn’t surprise you

3

slide-4
SLIDE 4

Networks are buggy, and that doesn’t surprise you

4

slide-5
SLIDE 5

Networks are buggy, and that doesn’t surprise you

5

slide-6
SLIDE 6

Network Verification

  • Sample data plane verification tools:

○ Anteater (SIGCOMM ‘11) ○ NetPlumber (NSDI ‘13)

  • Sample control plane verification tools:

○ rcc (NSDI ’05) ○ Batfish (NSDI ‘15) ○ ARC (SIGGCOMM ‘16) ○ NV (PLDI ‘20)

6

slide-7
SLIDE 7

Outline

  • 1. Overview of NV and its capabilities
  • 2. Speeding up verification with Hiding
  • 3. Wrap-up

7

slide-8
SLIDE 8

NV: A network verification language

0n 1n 2n

Topology

8

slide-9
SLIDE 9

NV: A network verification language

0n 1n 2n

Attributes

9

(0, 0n) (99, 1n) (99, 2n)

slide-10
SLIDE 10

(0, 0n) (99, 1n) (99, 2n)

NV: A network verification language

0n 1n 2n

Passing messages

10

(1, 0n) (100, 1n) T r a n s T r a n s

slide-11
SLIDE 11

(0, 0n) (99, 1n) (99, 2n)

NV: A network verification language

0n 1n 2n

Receiving messages

11

(1, 0n) (100, 1n)

slide-12
SLIDE 12

(0, 0n) (1, 0n) (99, 2n)

NV: A network verification language

0n 1n 2n

Receiving messages

12

(100, 1n)

slide-13
SLIDE 13

NV: A network verification language

0n 1n 2n

Receiving messages

13

(0, 0n) (1, 0n) (99, 2n)

slide-14
SLIDE 14

NV: A network verification language

0n 1n 2n

Receiving messages

14

(0, 0n) (1, 0n) (99, 2n) (2, 0n) T r a n s

slide-15
SLIDE 15

NV: A network verification language

0n 1n 2n

Steady state

15

(0, 0n) (1, 0n) (2, 0n)

slide-16
SLIDE 16

NV: A network verification language

0n 1n 2n

Verifying properties

16

(0, 0n) (1, 0n) (2, 0n) true true true

slide-17
SLIDE 17

Neighbors might send arbitrary messages

0n 1n 2n 3n (0, 0n) (99, 1n) (99, 2n) (?, 3n)

17

slide-18
SLIDE 18

Neighbors might send arbitrary messages

0n 1n 2n 3n (0, 0n) (1, 0n) (??, ??) (?, 3n)

18

Might hijack traffic between node 2 and node 0!

true true ??? true

slide-19
SLIDE 19

Solution: Use an SMT Solver

  • Find a steady state for the network, where no node prefers any of its

neighbors’ attributes to its own

  • Simulator computes a steady state, but there may be multiple
  • SMT solver checks if the assertion may be violated by any steady state
  • Requires heavy simplification to translate NV into SMT constraints

NV Transformation Pipeline SMT Solver Verified

Counter- example

User spec

19

slide-20
SLIDE 20

Transformation pipeline (for SMT)

User Program Type Inference Record Unrolling Inlining Map Unrolling Edge Unboxing Option Unboxing Tuple Flattening Slicing (optional) Unit Unboxing Z3 SMT Encoding BLUE boxes are compositional NV-to-NV transformations

Most blue boxes use a centralized mechanism for specifying transformations

20

slide-21
SLIDE 21

Transformation pipeline (for SMT)

User Program Type Inference Record Unrolling Inlining Map Unrolling Edge Unboxing Option Unboxing Tuple Flattening Slicing (optional) Unit Unboxing Z3 SMT Encoding

Map Unrolling has been particularly challenging

21

slide-22
SLIDE 22

Maps in NV

  • Maps (or dictionaries) are commonly used in networking
  • NV maps are total

22

slide-23
SLIDE 23

Encoding Map Operations

  • Some dictionary operations require quantifiers to encode into SMT

23

SMT Encoding

slide-24
SLIDE 24

Encoding Map Operations

  • Some dictionary operations require quantifiers to encode into SMT
  • In general, quantifiers in SMT are not complete

24

SMT Encoding SMT Solver

Unknown

slide-25
SLIDE 25

Static keys

  • Observation: In real networks, map keys are usually known in advance

○ E.g. Routers originate a fixed, known set of destinations ○ We see expression like m[3] , never m[...complicated computation…]_

25

slide-26
SLIDE 26

Static keys

  • Observation: In real networks, map keys are usually known in advance

○ E.g. Routers originate a fixed, known set of destinations ○ We see expression like m[3] , never m[...complicated computation…]_

  • Hence we can figure out which keys will be relevant statically by simply

scanning the program!

26

Only keys used are 3, 4, 7!

slide-27
SLIDE 27

Map Unrolling

  • Finitize maps by transforming them into tuples, with one element for each key

that is used

  • Require all map keys in NV programs to be literals
  • Doesn’t hinder translation of configs in practice

27

slide-28
SLIDE 28

Overview of NV

  • NV is a programming language in which programs are descriptions of

networks

  • Networks may be verified either with a simulator or an SMT solver
  • We use a pipeline of compositional transformations to translate NV programs

into SMT constraints

  • We encode dictionaries as tuples using Map Unrolling

28

slide-29
SLIDE 29

Problem: SMT analysis doesn’t scale well

29

slide-30
SLIDE 30

Networks contain a lot of irrelevant information

  • Observation: Network operators may not utilize every feature of every network

protocol

  • Observation: Not all features that are used may be relevant to the property

we’re verifying

○ E.g. checking the existence of a path may not require any information about that path’s length

  • Idea: Speed up verification by removing irrelevant information from the

network

30

slide-31
SLIDE 31

Many SMT constraints may be irrelevant

  • Observation: SMT solving is worst-case exponential in the number of

variables (for us, this is roughly equal to the number of constraints)

  • Observation: Most SMT constraints simply describe the stable state of the

network, and are rarely UNSAT. Only a few represent the assertion.

  • Idea: hide all the constraints except the assertion, and iteratively unhide them
  • nly when they become relevant (CEGAR-style).

31

slide-32
SLIDE 32

Hiding -- Initial Program

32

slide-33
SLIDE 33

Hiding -- Iteration 1

33

Hidden Program Full Program

slide-34
SLIDE 34

Hiding -- Iteration 1

34

Hidden Program Full Program

SAT: y1 = true, y2 = false

slide-35
SLIDE 35

Hiding -- Iteration 1

35

Hidden Program Full Program

SAT: y1 = true, y2 = false

slide-36
SLIDE 36

Hiding -- Iteration 1

36

Hidden Program Full Program

SAT: y1 = true, y2 = false UNSAT (Need info on: y1, y2)

slide-37
SLIDE 37

Hiding -- Iteration 2

37

Hidden Program Full Program

slide-38
SLIDE 38

Hiding -- Iteration 2

38

Hidden Program Full Program

SAT: y0 = true, y1 = true, y2 = false x0 = true, x1 = false

slide-39
SLIDE 39

Hiding -- Iteration 2

39

Hidden Program Full Program

SAT: y0 = true, y1 = true, y2 = false x0 = true, x1 = false

slide-40
SLIDE 40

Hiding -- Iteration 2

40

Hidden Program Full Program

SAT: y0 = true, y1 = true, y2 = false x0 = true, x1 = false UNSAT (Need info on: x0, x1)

slide-41
SLIDE 41

Hiding -- Iteration 3

41

Hidden Program Full Program

slide-42
SLIDE 42

Hiding -- Iteration 3

42

Hidden Program Full Program

UNSAT

slide-43
SLIDE 43

Hiding -- Iteration 3

43

Hidden Program Full Program

UNSAT Must also be UNSAT!

slide-44
SLIDE 44

Hiding - Algorithm Sketch

1. Create two copies of the SMT program -- one full, one with some constraints hidden 2. Check satisfiability for the hidden program

a. If it’s UNSAT, then so is the full program, so return. b. If it’s SAT, test the model on the full program

3. If the model extends to the full program, then it is also SAT, so return the full model 4. Otherwise, refine the hidden program by unhiding some constraints

a. Add constraints for all variables that appear in the UNSAT core

5. Go to step 2

44

slide-45
SLIDE 45

Hiding - Algorithm Sketch

1. Create two copies of the SMT program -- one full, one with some constraints hidden 2. Check satisfiability for the hidden program

a. If it’s UNSAT, then so is the full program, so return. b. If it’s SAT, test the model on the full program

3. If the model extends to the full program, then it is also SAT, so return the full model 4. Otherwise, refine the hidden program by unhiding some constraints

a. Add constraints for all variables that appear in the UNSAT core

5. Go to step 2

45

Guaranteed to terminate after a finite number of iterations, with the same result as the full program!

slide-46
SLIDE 46

Experimental Results

46

slide-47
SLIDE 47

Experimental Results

47

slide-48
SLIDE 48

Experimental Results

48

slide-49
SLIDE 49

Experimental Results

49

slide-50
SLIDE 50

Future Work

  • Heuristics for unhiding variables
  • DSL for specifying which variables should start hidden

50

slide-51
SLIDE 51

Related Work on Hiding

  • Hiding-style techniques were first proposed by Robert Kurshnan in 1994

○ Maintains relationships between variable using a variable dependency graph ○ It was also inspiration for the the original CEGAR paper in 2000

  • In 2007, Wang, Kim and Gupta proposed Hybrid CEGAR, which combines

hiding with predicate abstraction

  • The Corral verifier for Boogie (2011) practices a similar technique by only

inlining a few functions, then adding more as needed.

51

slide-52
SLIDE 52

Comparison of Hiding to Other Abstraction Techniques

  • CEGAR algorithm

○ Generates possibly-spurious counterexamples, then refines its abstraction

  • Guaranteed to terminate
  • No false positives or negatives
  • Subset of existing constraints

○ Can only use relationships that exist in the original constraints ○ Can’t replace data structures or relationships with more abstract versions ○ Could be combined with such techniques, however

52

slide-53
SLIDE 53

In Summary...

  • I presented my work on developing NV, a programming language for network

verification

  • I worked on a pipeline of simplifications for encoding NV into SMT constraints
  • I wrote an algorithm called Hiding which aims to speed up verification by

removing irrelevant information

  • Initial tests for hiding indicate that it can discover effective abstractions, but

takes too long to do so

  • Future work involves heuristics and hints to make hiding converge faster

53

slide-54
SLIDE 54

Questions?

54