p4v
play

p4v Practical Verification for Programmable Data Planes Jed Liu - PowerPoint PPT Presentation

p4v Practical Verification for Programmable Data Planes Jed Liu Robert Soul Bill Hallahan Han Wang Cole Schlesinger Clin Cacaval Milad Sharif Nick McKeown Jeongkeun Lee Nate Foster Fixed-function routers... Fixed-function


  1. p4v Practical Verification for Programmable Data Planes Jed Liu Robert Soulé Bill Hallahan Han Wang Cole Schlesinger Călin Caşcaval Milad Sharif Nick McKeown Jeongkeun Lee Nate Foster

  2. Fixed-function routers...

  3. Fixed-function routers... ...how do we know that they work? (with apologies to Insane Clown Posse)

  4. Fixed-function routers... ...how do we know that they work? By testing!

  5. Fixed-function routers... ...how do we know that they work? By testing! ● Expensive — lots of packet formats & protocols ● Pay cost once, during manufacturing

  6. Programmable routers... (specifically, programmable data planes) ...how do they work? Arista 7170 series switches

  7. Programmable routers... (specifically, programmable data planes) Barefoot Tofino chip ...how do they work? Arista 7170 series switches

  8. Programmable routers... (specifically, programmable data planes) ...how do they work? Arista 7170 series switches

  9. Programmable routers... (specifically, programmable data planes) ● New hotness ○ Rapid innovation ○ Novel uses of network ✦ In-band network telemetry ✦ In-network caching ● No longer have economy of scale for traditional testing Arista 7170 series switches

  10. Let’s verify! Bit-level description of data-plane behaviour Give programmers language-based verification tools P4 also used as HDL for fixed-function devices Arista 7170 series switches

  11. p4v overview ● Automated tool for verifying P4 programs ● Considers all paths ○ But also practical for large programs ● Includes basic safety properties for any program ● Extensible framework ○ Verify custom, program-specific properties ○ Assert-style debugging

  12. Anatomy of a P4 program /* Headers and Instances */ /* Actions */ header_type ethernet_t { Actions action allow() { fields { modify_field(standard_metadata.egress_spec,1); dst_addr:48; } Modify headers, src_addr:48; action deny() { drop(); } ether_type:16; action nop() { } } specify forwarding action rewrite(dst_addr) { } modify_field(ipv4.dst_addr,dst_addr); header_type ipv4_t { Headers } fields { pre_ttl:64; /* Tables */ ttl:8; table acl { protocol:8; reads { checksum:16; ipv4.src_addr:lpm; Tables src_addr:32; ipv4.dst_addr:lpm; dst_addr:32; } } Apply actions actions { allow; deny; } } } header ethernet_t ethernet; based on header data header ipv4_t ipv4; table nat { reads { ipv4.dst_addr:lpm; } /* Parsers */ actions { rewrite; nop; } parser start { default_action: nop(); Parsers extract(ethernet); } return select(ethernet.ether_type) { 0x800: parse_ipv4; Convert bitstreams /* Controls */ default: ingress; Controls control ingress { } apply(nat); into headers } apply(acl); Sequences of tables parser parse_ipv4 { } extract(ipv4); return ingress; control egress { } }

  13. P4 hardware model PISA [SIGCOMM 2013] Protocol-Independent Switch Architecture Traffic Manager Parser Ingress Queuing Egress Deparser

  14. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! ○ IPv6 router w/ access control list (ACL)

  15. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! control ingress { apply(acl); } ○ IPv6 router w/ access control list (ACL) table acl { }

  16. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! control ingress { apply(acl); } ○ IPv6 router w/ access control list (ACL) table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } }

  17. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! control ingress { apply(acl); } ○ IPv6 router w/ access control list (ACL) table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } } action allow() { modify_field(std_meta.egress_spec, 1); }

  18. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! control ingress { apply(acl); } ○ IPv6 router w/ access control list (ACL) table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } } action allow() { modify_field(std_meta.egress_spec, 1); } action deny() { drop(); }

  19. P4 by example ● P4 is a low-level language → many gotchas ● Let’s explore by example! control ingress { apply(acl); } ○ IPv6 router w/ access control list (ACL) table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } } action allow() { modify_field(std_meta.egress_spec, 1); } action deny() { drop(); } What could possibly go wrong?

  20. What if we didn’t receive an IPv6 packet? ipv6 header will be invalid What goes wrong Table reads arbitrary values control ingress { apply(acl); } → Intended ACL policy violated table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } } action allow() { modify_field(std_meta.egress_spec, 1); } action deny() { drop(); }

  21. What if we didn’t receive an IPv6 packet? ipv6 header will be invalid What goes wrong Table reads arbitrary values control ingress { apply(acl); } → Intended ACL policy violated table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } Can read values from a previous packet } → Side channel vulnerability! action allow() { modify_field(std_meta.egress_spec, 1); } action deny() { drop(); }

  22. What if we didn’t receive an IPv6 packet? ipv6 header will be invalid What goes wrong Table reads arbitrary values control ingress { apply(acl); } → Intended ACL policy violated table acl { reads { ipv6.dstAddr: lpm ; } actions { allow; deny; } Can read values from a previous packet } → Side channel vulnerability! action allow() { modify_field(std_meta.egress_spec, 1); } Real programs are complicated: action deny() { drop(); } hard to keep validity in your head Property #1: header validity

  23. What if acl table misses (no rule matches)? Forwarding decision is unspecified What goes wrong Forwarding behaviour depends on control ingress { apply(acl); } hardware table acl { reads { ipv6.dstAddr: lpm ; } ● May not do what you expect! actions { allow; deny; } ● Code not portable } action allow() { modify_field(std_meta.egress_spec, 1); } action deny() { drop(); } Property #2: unambiguous forwarding

  24. Let’s add 6in4 tunnelling! table tunnel_decap { ... ethernet ipv4 inner_ipv6 actions { decap_6in4; } etherType “ipv4” } action decap_6in4() { copy_header(ipv6, inner_ipv6); remove_header(inner_ipv6); } table tunnel_term { ... actions { term_6in4; } } action term_6in4() { remove_header(ipv4); modify_field(ethernet.etherType, 0x86dd); }

  25. Let’s add 6in4 tunnelling! table tunnel_decap { ... ethernet ipv4 inner_ipv6 actions { decap_6in4; } etherType “ipv4” } action decap_6in4() { tunnel_decap copy_header(ipv6, inner_ipv6); remove_header(inner_ipv6); ipv4 } ethernet ipv6 table tunnel_term { etherType “ipv4” ... actions { term_6in4; } } action term_6in4() { remove_header(ipv4); modify_field(ethernet.etherType, 0x86dd); }

  26. Let’s add 6in4 tunnelling! table tunnel_decap { ... ethernet ipv4 inner_ipv6 actions { decap_6in4; } etherType “ipv4” } action decap_6in4() { tunnel_decap copy_header(ipv6, inner_ipv6); remove_header(inner_ipv6); ipv4 } ethernet ipv6 table tunnel_term { etherType “ipv4” ... actions { term_6in4; } tunnel_term } action term_6in4() { ethernet ipv6 remove_header(ipv4); modify_field(ethernet.etherType, 0x86dd); etherType “ ipv6 ” }

  27. Let’s add 6in4 tunnelling! ipv4 ethernet ipv6 etherType “ipv4”

  28. A look behind the curtain In PISA, state is copied verbatim from ingress to egress... Traffic Manager Parser Ingress Egress Deparser 28

  29. A look behind the curtain In PISA, state is copied verbatim from ingress to egress… Some architectures use parser and deparser to bridge state! TM Parser Ingress Egress Deparser 29

  30. What if the architecture reparses the packet? ● IPv4 and IPv6 are mutually exclusive protocols What goes wrong ipv4 ethernet ipv6 etherType “ipv4”

  31. What if the architecture reparses the packet? ● IPv4 and IPv6 are mutually exclusive protocols What goes wrong ipv4 deparse ethernet ipv6 ipv4 ethernet ipv6 etherType “ipv4” etherType “ipv4”

  32. What if the architecture reparses the packet? ● IPv4 and IPv6 are mutually exclusive protocols What goes wrong ipv4 deparse parse ethernet ipv6 ipv4 ethernet ipv6 etherType “ipv4” etherType “ipv4”

  33. What if the architecture reparses the packet? ● IPv4 and IPv6 are mutually exclusive protocols What goes wrong ipv4 deparse parse ethernet ipv6 ipv4 ethernet ipv6 etherType “ipv4” etherType “ipv4” Property #3: reparseability

  34. Another look behind the curtain ● Hardware devices have limited resources ● Compilers have options to improve resource usage ○ e.g., if headers are mutually exclusive in parser, assume they stay mutually exclusive in rest of program ○ Mutually exclusive headers can be overlaid in memory! ipv4 inner_ipv6 ethernet ipv6

  35. What if headers share memory? ● IPv4 and IPv6 might be overlaid ethernet ipv4 inner_ipv6 etherType “ipv4” What goes wrong tunnel_decap Data corruption ● e.g., tunnel_decap clobbers ipv4 ipv4 ethernet ipv6 etherType “ipv4” Parsers are complicated in practice Hard to keep track of mutually exclusive states Property #4: mutual exclusion of headers

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