Preface |
|
ix | |
|
1 What Is eBPF, and Why Is It Important? |
|
|
1 | (14) |
|
eBPFs Roots: The Berkeley Packet Filter |
|
|
1 | (1) |
|
|
2 | (1) |
|
The Evolution of eBPF to Production Systems |
|
|
3 | (2) |
|
|
5 | (1) |
|
|
5 | (2) |
|
Adding New Functionality to the Kernel |
|
|
7 | (1) |
|
|
8 | (1) |
|
Dynamic Loading of eBPF Programs |
|
|
9 | (1) |
|
High Performance of eBPF Programs |
|
|
10 | (1) |
|
eBPF in Cloud Native Environments |
|
|
11 | (2) |
|
|
13 | (2) |
|
|
15 | (22) |
|
|
15 | (3) |
|
|
18 | (2) |
|
|
20 | (1) |
|
|
21 | (3) |
|
Perf and Ring Buffer Maps |
|
|
24 | (5) |
|
|
29 | (1) |
|
|
30 | (5) |
|
|
35 | (1) |
|
|
35 | (2) |
|
3 Anatomy of an eBPF Program |
|
|
37 | (22) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
38 | (2) |
|
eBPF "Hello World" for a Network Interface |
|
|
40 | (2) |
|
Compiling an eBPF Object File |
|
|
42 | (1) |
|
Inspecting an eBPF Object File |
|
|
42 | (3) |
|
Loading the Program into the Kernel |
|
|
45 | (1) |
|
Inspecting the Loaded Program |
|
|
45 | (2) |
|
|
47 | (1) |
|
|
47 | (1) |
|
The JIT-Compiled Machine Code |
|
|
48 | (1) |
|
|
49 | (2) |
|
|
51 | (2) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (2) |
|
|
56 | (1) |
|
|
56 | (3) |
|
|
59 | (20) |
|
|
63 | (1) |
|
|
63 | (1) |
|
|
64 | (1) |
|
Modifying a Map from User Space |
|
|
65 | (2) |
|
BPF Program and Map References |
|
|
67 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
Additional Syscalls Involved in eBPF |
|
|
69 | (1) |
|
Initializing the Perf Buffer |
|
|
69 | (1) |
|
Attaching to Kprobe Events |
|
|
70 | (1) |
|
Setting Up and Reading Perf Events |
|
|
71 | (1) |
|
|
72 | (2) |
|
Reading Information from a Map |
|
|
74 | (1) |
|
|
74 | (1) |
|
|
75 | (1) |
|
|
76 | (1) |
|
|
77 | (2) |
|
|
79 | (30) |
|
BCC s Approach to Portability |
|
|
80 | (1) |
|
|
81 | (1) |
|
|
82 | (1) |
|
|
82 | (1) |
|
Listing BTF Information with bpftool |
|
|
83 | (2) |
|
|
85 | (2) |
|
Maps with BTF Information |
|
|
87 | (1) |
|
BTF Data for Functions and Function Prototypes |
|
|
88 | (1) |
|
Inspecting BTF Data for Maps and Programs |
|
|
89 | (1) |
|
Generating a Kernel Header File |
|
|
89 | (2) |
|
|
91 | (1) |
|
|
91 | (2) |
|
|
93 | (1) |
|
|
94 | (3) |
|
|
97 | (1) |
|
|
98 | (1) |
|
Compiling eBPF Programs for CO-RE |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
99 | (1) |
|
BTF Information in the Object File |
|
|
100 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
The Libbpf Library for User Space |
|
|
102 | (1) |
|
|
102 | (4) |
|
|
106 | (1) |
|
|
106 | (1) |
|
|
107 | (2) |
|
|
109 | (16) |
|
|
110 | (1) |
|
|
111 | (2) |
|
|
113 | (1) |
|
Validating Helper Functions |
|
|
114 | (1) |
|
Helper Function Arguments |
|
|
115 | (1) |
|
|
116 | (1) |
|
|
116 | (3) |
|
Checking Pointers Before Dereferencing Them |
|
|
119 | (1) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (2) |
|
7 eBPF Program and Attachment Types |
|
|
125 | (18) |
|
Program Context Arguments |
|
|
126 | (1) |
|
Helper Functions and Return Codes |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
127 | (1) |
|
|
128 | (2) |
|
|
130 | (1) |
|
|
131 | (2) |
|
|
133 | (1) |
|
|
133 | (2) |
|
|
135 | (1) |
|
|
135 | (2) |
|
|
137 | (1) |
|
|
137 | (1) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
138 | (1) |
|
|
138 | (1) |
|
|
139 | (1) |
|
|
139 | (1) |
|
|
140 | (1) |
|
|
140 | (3) |
|
|
143 | (28) |
|
|
144 | (1) |
|
|
144 | (1) |
|
|
145 | (3) |
|
Load Balancing and Forwarding |
|
|
148 | (3) |
|
|
151 | (2) |
|
|
153 | (4) |
|
Packet Encryption and Decryption |
|
|
157 | (1) |
|
|
157 | (3) |
|
eBPF and Kubernetes Networking |
|
|
160 | (3) |
|
|
163 | (1) |
|
Coordinated Network Programs |
|
|
163 | (2) |
|
Network Policy Enforcement |
|
|
165 | (1) |
|
|
166 | (2) |
|
|
168 | (1) |
|
Exercises and Further Reading |
|
|
169 | (2) |
|
|
171 | (14) |
|
Security Observability Requires Policy and Context |
|
|
171 | (2) |
|
Using System Calls for Security Events |
|
|
173 | (1) |
|
|
173 | (1) |
|
Generating Seccomp Profiles |
|
|
174 | (2) |
|
Syscall-Tracking Security Tools |
|
|
176 | (2) |
|
|
178 | (1) |
|
|
179 | (1) |
|
Attaching to Internal Kernel Functions |
|
|
180 | (1) |
|
|
181 | (1) |
|
|
182 | (1) |
|
|
183 | (2) |
|
|
185 | (18) |
|
|
185 | (4) |
|
Language Choices for eBPF in the Kernel |
|
|
189 | (1) |
|
|
190 | (2) |
|
|
192 | (1) |
|
|
193 | (1) |
|
|
193 | (1) |
|
|
193 | (3) |
|
|
196 | (1) |
|
|
196 | (1) |
|
|
197 | (1) |
|
|
197 | (1) |
|
|
198 | (2) |
|
|
200 | (1) |
|
|
200 | (1) |
|
|
200 | (1) |
|
|
201 | (1) |
|
|
202 | (1) |
|
11 The Future Evolution of eBPF |
|
|
203 | (6) |
|
|
203 | (1) |
|
|
204 | (2) |
|
|
206 | (2) |
|
eBPF Is a Platform, Not a Feature |
|
|
208 | (1) |
Conclusion |
|
209 | (2) |
Index |
|
211 | |