Automated Synthesis of Adversarial Workloads for Network Functions
Luis Pedrosa, Rishabh Iyer, Arseniy Zaostrovnykh, Jonas Fietz, Katerina Argyraki
Software NFs The good: The fmexibility of software The software - - PowerPoint PPT Presentation
Automated Synthesis of Adversarial Workloads for Network Functions Luis Pedrosa, Rishabh Iyer, Arseniy Zaostrovnykh, Jonas Fietz, Katerina Argyraki N etwork A rchitecture L aboratory Software NFs The good: The fmexibility of software The
Automated Synthesis of Adversarial Workloads for Network Functions
Luis Pedrosa, Rishabh Iyer, Arseniy Zaostrovnykh, Jonas Fietz, Katerina Argyraki
2
Software NFs
The good:
The fmexibility of software The software development cycle
The bad:
The reliability of software Inconsistent performance
The ugly:
Adversarial traffjc / DoS / Slowdowns
3
We need better tools...
Dynamic analysis: profjling
Reasons about known inputs Helps fjnd root cause / debug Only as good as the inputs used
4
WCET
We need better tools...
Static analysis
Reasons about potential inputs in abstract Over-approximating: WCET Under-approximating: adversarial inputs
MAX Latency (not to scale) Typical Adversarial
5
Statically analyze NF
Analyze code Generate PCAP fjle with adversarial workload
Exploit
The CPU cache hierarchy Algorithmic complexity
It works!
Increased NF latency up to 3×
CASTAN – Cycle Approximating Symbolic Timing Analysis for NFs
6
Outline
Introduction SymbEx in a Nutshell CASTAN Evaluation Conclusion
7
SymbEx in a Nutshell
Procedure Interpret code with symbolic values
1 : i n t v a r = i n p u t ( ) ; 2 : r e t u r n v a r + + ; / / α / / + 1 α
8
SymbEx in a Nutshell
Procedure Interpret code with symbolic values
1 : i n t v a r = i n p u t ( ) ; / / α 2 : i f ( v a r > = ) { 3 : r e t u r n v a r ; 4 : } e l s e { 5 : r e t u r n
a r ; 6 : }
9
SymbEx in a Nutshell
Procedure Interpret code with symbolic values Fork execution on symbolic conditions Keep track of path constraints
1 : i n t v a r = i n p u t ( ) ; / / α 2 : i f ( v a r > = ) { 3 : r e t u r n v a r ; 4 : } e l s e { 5 : r e t u r n
a r ; 6 : } / / i f > = α α / /
f < α α
10
SymbEx in a Nutshell
Procedure Interpret code with symbolic values Fork execution on symbolic conditions Keep track of path constraints SMT solver fjnds concrete inputs
1 : i n t v a r = i n p u t ( ) ; / / α 2 : i f ( v a r > = ) { 3 : r e t u r n v a r ; 4 : } e l s e { 5 : r e t u r n
a r ; 6 : } / / i f > = α α / /
f < α α , e . g . = α , e . g . =
α
11
SymbEx in a Nutshell
Challenges
Path Explosion! T ypically exponential # of paths / branch Unbounded with loops Impractical to SymbEx exhaustively
12
SymbEx in a Nutshell
Mitigation
Can’t do everything: prioritize! Directed Symbolic Execution
Prioritize executing relevant paths over others Graph search with heuristic T ry to reach a bug / increase coverage / etc. Stop SEE when satisfjed (or impatient)
13
CASTAN
Overview
Generate adversarial NF workloads
Packet sequence ⇒ more CPU cycles / packet
Under-approximate: not WCET Largely automated
14
CASTAN
Approach
Exploits performance variation
15
CASTAN
Attacking the CPU Cache
Symbolic Pointers
Index into memory with packet: a r r a y [ p a c k e t . d s t _ a d d r ] Find packets ⇒ memory addresses ⇒ DRAM access
CPU Cache Model
Simple 1-tier model of the LLC Models contention, associativity, write-back Empirical contention set model
16
CASTAN
Attacking Algorithmic Complexity
Maximize Instructions / Packet
Find packets ⇒ longer code paths
Guide SymbEx with a Heuristic
Maximize cycles w/o inducing breadth-fjrst-search Estimate cycles / packet
Receive Packet Receive Packet
17
CASTAN
Attacking Algorithmic Complexity
CFG Distance Heuristic
max(successors)+cost<current> cost = cycles conservatively assuming an L1 hit
18
CASTAN
Attacking Algorithmic Complexity
CFG Distance Heuristic
max(successors)+cost<current> cost = cycles conservatively assuming an L1 hit
19
CASTAN
Attacking Algorithmic Complexity
CFG Distance Heuristic
max(successors)+cost<current> cost = cycles conservatively assuming an L1 hit 1 2
3
20
CASTAN
Attacking Algorithmic Complexity
CFG Distance Heuristic
max(successors)+cost<current> cost = cycles conservatively assuming an L1 hit 1 2
3
1 2 4 3 5
21
CASTAN
Attacking Algorithmic Complexity
Handling Loops
Distance vector algorithm Limit repeats to 2 (unrolls loops once)
22
CASTAN
Attacking Algorithmic Complexity
Handling Loops
Distance vector algorithm Limit repeats to 2 (unrolls loops once)
23
CASTAN
Attacking Algorithmic Complexity
Handling Loops
Distance vector algorithm Limit repeats to 2 (unrolls loops once)
1 4 2 3 3
24
CASTAN
Attacking Algorithmic Complexity
Handling Loops
Distance vector algorithm Limit repeats to 2 (unrolls loops once)
1 4 2 3 3
25
CASTAN
Attacking Algorithmic Complexity
Handling Loops
Distance vector algorithm Limit repeats to 2 (unrolls loops once)
1 4 2 3 3 5 8 6 7 7
26
CASTAN
Handling Hash Functions
SymbExing hash functions is hard
Complex expression / Path explosion Reason about hash value, without computing it?
27
CASTAN
Handling Hash Functions
SymbExing hash functions is hard
Complex expression / Path explosion Reason about hash value, without computing it?
Havocing
Annotate and disable hash function Assign hash value a new symbol Analyze data structure internals unencumbered Find packet ⇒ hash value ⇒ expected behavior
28
CASTAN
Handling Hash Functions Packets Hash Inputs Hashes Solve Hashes Reverse Hashes Solve Packets
29
Evaluation
Setup
Network Measurement Campaign
E2E Latency / Throughput Intel Xeon E5-2667v2 3.3GHz
25.6MB LLC / 32GB RAM
Intel 82599ES 10Gb NICs
Tester DUT
30
Evaluation
NFs
11 NF Implementations
3 types, difgerent data structures
NAT LB LPM Unbalanced Tree
31
Evaluation
NFs
11 NF Implementations
3 types, difgerent data structures
NAT LB LPM Unbalanced Tree
Complexity Cache
32
Evaluation
Workloads
Baseline
NOP
Adversarial
CASTAN (~50 fmows), Manual (~50 fmows)
Random
UniRand (1Mfmows) Zipf (100kpkts, 6.7kfmows) UniRand CASTAN (# fmows = CASTAN)
33
Evaluation
LPM / Single Lookup Table
3× 3×
CDF
34
Evaluation
LPM / Single Lookup Table
3× 3×
CDF
CASTAN induces DRAM accesses 3× Latency ≃ UniRand; 2×105 fewer flows
35
Evaluation
LPM / Single Lookup Table
36
Evaluation
NAT / Unbalanced Tree
1.7× 1.7×
CDF
37
Evaluation
NAT / Unbalanced Tree
1.7× 1.7×
CDF
CASTAN skews the tree +70% Latency / -7% Throughput ≃ Manual; without intuition
38
Conclusion
CASTAN
Attacks complexity, CPU cache, hash functions Little developer input
Adversarial Workloads
≃ Manual when available > Uniform random for same number of fmows Up to +201% latency / -19% throughput
39
Find out more!
Look for our poster! Get the source and more: https://pedrosa.2y.net/Projects/CASTAN
40
Backup Slides
41
Cache Structure
3 bits 6 bits 6 bits 15 bits byte offset L1d line L2 line L3 slice 34 bits 1GB page offset 1GB page index
42
Latency Deviation from NOP
43
Throughput
44
LPM / Single Lookup Table
45
NAT / Unbalanced Tree
46
NAT / Hash Ring
47
NAT / Red-Black Tree
48
NAT / Hash Table
49
LPM / Hierarchical Lookup (DPDK)
50
LPM / Patricia Trie
51
LB / Unbalanced Tree
52
LB / Red-Black Tree
53
LB / Hash Ring
54
LB / Hash Table