• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Alan-Jowett / ebpf-verifier / 18949625295

28 Oct 2025 10:33AM UTC coverage: 87.448% (-1.0%) from 88.47%
18949625295

push

github

elazarg
Bump CLI11 to v2.6.1

Signed-off-by: Elazar Gershuni <elazarg@gmail.com>

9022 of 10317 relevant lines covered (87.45%)

10783407.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.75
/src/test/test_verify.cpp
1
// Copyright (c) Prevail Verifier contributors.
2
// SPDX-License-Identifier: MIT
3
#include <catch2/catch_all.hpp>
4
#include <thread>
5

6
#include "ebpf_verifier.hpp"
7
#include "linux/gpl/spec_type_descriptors.hpp"
8

9
using namespace prevail;
10

11
#define FAIL_LOAD_ELF(dirname, filename, sectionname)                                                \
12
    TEST_CASE("Try loading nonexisting program: " dirname "/" filename, "[elf]") {                   \
13
        try {                                                                                        \
14
            thread_local_options = {};                                                               \
15
            read_elf("ebpf-samples/" dirname "/" filename, sectionname, {}, &g_ebpf_platform_linux); \
16
            REQUIRE(false);                                                                          \
17
        } catch (const std::runtime_error&) {                                                        \
18
        }                                                                                            \
19
    }
20

21
// Some intentional failures
22
FAIL_LOAD_ELF("cilium", "not-found.o", "2/1")
9✔
23
FAIL_LOAD_ELF("cilium", "bpf_lxc.o", "not-found")
9✔
24
FAIL_LOAD_ELF("build", "badrelo.o", ".text")
9✔
25
FAIL_LOAD_ELF("invalid", "badsymsize.o", "xdp_redirect_map")
9✔
26

27
#define FAIL_UNMARSHAL(dirname, filename, sectionname)                                                            \
28
    TEST_CASE("Try unmarshalling bad program: " dirname "/" filename " " sectionname, "[unmarshal]") {            \
29
        thread_local_options = {};                                                                                \
30
        auto raw_progs = read_elf("ebpf-samples/" dirname "/" filename, sectionname, {}, &g_ebpf_platform_linux); \
31
        REQUIRE(raw_progs.size() == 1);                                                                           \
32
        const RawProgram& raw_prog = raw_progs.back();                                                            \
33
        std::variant<InstructionSeq, std::string> prog_or_error = unmarshal(raw_prog);                            \
34
        REQUIRE(std::holds_alternative<std::string>(prog_or_error));                                              \
35
    }
36

37
// Some intentional unmarshal failures
38
FAIL_UNMARSHAL("build", "wronghelper.o", "xdp")
11✔
39
FAIL_UNMARSHAL("invalid", "invalid-lddw.o", ".text")
11✔
40

41
// Verify a program in a section that may have multiple programs in it.
42
#define VERIFY_PROGRAM(dirname, filename, section_name, program_name, _options, platform, should_pass, count) \
43
    do {                                                                                                      \
44
        thread_local_options = _options;                                                                      \
45
        const auto raw_progs = read_elf("ebpf-samples/" dirname "/" filename, section_name, {}, platform);    \
46
        REQUIRE(raw_progs.size() == count);                                                                   \
47
        for (const auto& raw_prog : raw_progs) {                                                              \
48
            if (count == 1 || raw_prog.function_name == program_name) {                                       \
49
                const auto prog_or_error = unmarshal(raw_prog);                                               \
50
                const auto inst_seq = std::get_if<InstructionSeq>(&prog_or_error);                            \
51
                REQUIRE(inst_seq);                                                                            \
52
                const Program prog = Program::from_sequence(*inst_seq, raw_prog.info, thread_local_options);  \
53
                REQUIRE(verify(prog) == should_pass);                                                         \
54
            }                                                                                                 \
55
        }                                                                                                     \
56
    } while (0)
57

58
// Verify a section with only one program in it.
59
#define VERIFY_SECTION(dirname, filename, section_name, _options, platform, should_pass) \
60
    VERIFY_PROGRAM(dirname, filename, section_name, "", _options, platform, should_pass, 1)
61

62
#define TEST_SECTION(project, filename, section)                                      \
63
    TEST_CASE(project "/" filename " " section, "[verify][samples][" project "]") {   \
64
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, true); \
65
    }
66

67
#define TEST_SECTION_SLOW(project, filename, section)                                     \
68
    TEST_CASE(project "/" filename " " section, "[verify][samples][slow][" project "]") { \
69
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, true);     \
70
    }
71

72
#define TEST_PROGRAM(project, filename, section_name, program_name, count)                                      \
73
    TEST_CASE(project "/" filename " " program_name, "[verify][samples][" project "]") {                        \
74
        VERIFY_PROGRAM(project, filename, section_name, program_name, {}, &g_ebpf_platform_linux, true, count); \
75
    }
76

77
#define TEST_PROGRAM_FAIL(project, filename, section_name, program_name, count)                                 \
78
    TEST_CASE(project "/" filename " " program_name, "[!shouldfail][verify][samples][" project "]") {           \
79
        VERIFY_PROGRAM(project, filename, section_name, program_name, {}, &g_ebpf_platform_linux, true, count); \
80
    }
81

82
#define TEST_PROGRAM_REJECT(project, filename, section_name, program_name, count)                                \
83
    TEST_CASE(project "/" filename " " program_name, "[verify][samples][" project "]") {                         \
84
        VERIFY_PROGRAM(project, filename, section_name, program_name, {}, &g_ebpf_platform_linux, false, count); \
85
    }
86

87
#define TEST_PROGRAM_REJECT_FAIL(project, filename, section_name, program_name, count)                           \
88
    TEST_CASE(project "/" filename " " program_name, "[!shouldfail][verify][samples][" project "]") {            \
89
        VERIFY_PROGRAM(project, filename, section_name, program_name, {}, &g_ebpf_platform_linux, false, count); \
90
    }
91

92
#define TEST_SECTION_REJECT(project, filename, section)                                \
93
    TEST_CASE(project "/" filename " " section, "[verify][samples][" project "]") {    \
94
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, false); \
95
    }
96

97
#define TEST_SECTION_REJECT_IF_STRICT(project, filename, section)                           \
98
    TEST_CASE(project "/" filename " " section, "[verify][samples][" project "]") {         \
99
        ebpf_verifier_options_t options{};                                                  \
100
        VERIFY_SECTION(project, filename, section, options, &g_ebpf_platform_linux, true);  \
101
        options.strict = true;                                                              \
102
        VERIFY_SECTION(project, filename, section, options, &g_ebpf_platform_linux, false); \
103
    }
104

105
#define TEST_SECTION_FAIL(project, filename, section)                                                              \
106
    TEST_CASE("expect failure " project "/" filename " " section, "[!shouldfail][verify][samples][" project "]") { \
107
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, true);                              \
108
    }
109

110
#define TEST_SECTION_FAIL_SLOW(project, filename, section)                            \
111
    TEST_CASE("expect failure " project "/" filename " " section,                     \
112
              "[!shouldfail][verify][samples][slow][" project "]") {                  \
113
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, true); \
114
    }
115

116
#define TEST_SECTION_REJECT_FAIL(project, filename, section)                                                       \
117
    TEST_CASE("expect failure " project "/" filename " " section, "[!shouldfail][verify][samples][" project "]") { \
118
        VERIFY_SECTION(project, filename, section, {}, &g_ebpf_platform_linux, false);                             \
119
    }
120

121
#define TEST_LEGACY(dirname, filename, sectionname)                                                  \
122
    TEST_CASE("Fail unmarshalling: " dirname "/" filename " " sectionname, "[unmarshal]") {          \
123
        ebpf_platform_t platform = g_ebpf_platform_linux;                                            \
124
        platform.supported_conformance_groups &= ~bpf_conformance_groups_t::packet;                  \
125
        auto raw_progs = read_elf("ebpf-samples/" dirname "/" filename, sectionname, {}, &platform); \
126
        REQUIRE(raw_progs.size() == 1);                                                              \
127
        RawProgram raw_prog = raw_progs.back();                                                      \
128
        std::variant<InstructionSeq, std::string> prog_or_error = unmarshal(raw_prog);               \
129
        REQUIRE(std::holds_alternative<std::string>(prog_or_error));                                 \
130
    }
131

132
#define TEST_SECTION_LEGACY(dirname, filename, sectionname) \
133
    TEST_SECTION(dirname, filename, sectionname)            \
134
    TEST_LEGACY(dirname, filename, sectionname)
135

136
#define TEST_SECTION_LEGACY_SLOW(dirname, filename, sectionname) \
137
    TEST_SECTION_SLOW(dirname, filename, sectionname)            \
138
    TEST_LEGACY(dirname, filename, sectionname)
139

140
#define TEST_SECTION_LEGACY_FAIL(dirname, filename, sectionname) \
141
    TEST_SECTION_FAIL(dirname, filename, sectionname)            \
142
    TEST_LEGACY(dirname, filename, sectionname)
143

144
TEST_SECTION_SLOW("bpf_cilium_test", "bpf_lxc_jit.o", "1/0xdc06")
14✔
145
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "2/1")
14✔
146
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "2/3")
14✔
147
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "2/4")
14✔
148
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "2/5")
14✔
149
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "2/6")
14✔
150
TEST_SECTION_SLOW("bpf_cilium_test", "bpf_lxc_jit.o", "2/7")
14✔
151
TEST_SECTION_LEGACY_SLOW("bpf_cilium_test", "bpf_lxc_jit.o", "2/10")
25✔
152
TEST_SECTION("bpf_cilium_test", "bpf_lxc_jit.o", "from-container")
14✔
153

154
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "1/0x1010")
14✔
155
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/1")
14✔
156
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/2")
14✔
157
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/3")
14✔
158
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/4")
14✔
159
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/5")
14✔
160
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/6")
14✔
161
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "2/7")
14✔
162
TEST_SECTION_LEGACY("bpf_cilium_test", "bpf_lxc-DUNKNOWN.o", "from-container")
25✔
163

164
TEST_SECTION_SLOW("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "1/0x1010")
14✔
165
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/1")
14✔
166
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/2")
14✔
167
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/3")
14✔
168
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/4")
14✔
169
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/5")
14✔
170
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/6")
14✔
171
TEST_SECTION_SLOW("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "2/7")
14✔
172
TEST_SECTION("bpf_cilium_test", "bpf_lxc-DDROP_ALL.o", "from-container")
14✔
173

174
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/1")
14✔
175
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/2")
14✔
176
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/3")
14✔
177
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/4")
14✔
178
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/5")
14✔
179
TEST_SECTION("bpf_cilium_test", "bpf_netdev.o", "2/7")
14✔
180

181
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/1")
14✔
182
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/2")
14✔
183
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/3")
14✔
184
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/4")
14✔
185
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/5")
14✔
186
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "2/7")
14✔
187
TEST_SECTION("bpf_cilium_test", "bpf_overlay.o", "3/2")
14✔
188
TEST_SECTION_LEGACY_SLOW("bpf_cilium_test", "bpf_overlay.o", "from-overlay")
25✔
189

190
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L3.o", "2/1")
14✔
191
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L3.o", "2/2")
14✔
192
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L3.o", "from-netdev")
14✔
193

194
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L4.o", "2/1")
14✔
195
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L4.o", "2/2")
14✔
196
TEST_SECTION("bpf_cilium_test", "bpf_lb-DLB_L4.o", "from-netdev")
14✔
197

198
TEST_SECTION("bpf_cilium_test", "bpf_lb-DUNKNOWN.o", "2/1")
14✔
199
TEST_SECTION("bpf_cilium_test", "bpf_lb-DUNKNOWN.o", "2/2")
14✔
200
TEST_SECTION("bpf_cilium_test", "bpf_lb-DUNKNOWN.o", "from-netdev")
14✔
201

202
TEST_SECTION("cilium", "bpf_lb.o", "2/1")
14✔
203
TEST_SECTION("cilium", "bpf_lb.o", "from-netdev")
14✔
204

205
TEST_SECTION("cilium", "bpf_lxc.o", "1/0x1010")
14✔
206
TEST_SECTION("cilium", "bpf_lxc.o", "2/1")
14✔
207
TEST_SECTION("cilium", "bpf_lxc.o", "2/3")
14✔
208
TEST_SECTION("cilium", "bpf_lxc.o", "2/4")
14✔
209
TEST_SECTION("cilium", "bpf_lxc.o", "2/5")
14✔
210
TEST_SECTION("cilium", "bpf_lxc.o", "2/6")
14✔
211
TEST_SECTION("cilium", "bpf_lxc.o", "2/8")
14✔
212
TEST_SECTION("cilium", "bpf_lxc.o", "2/9")
14✔
213
TEST_SECTION("cilium", "bpf_lxc.o", "from-container")
14✔
214

215
TEST_SECTION("cilium", "bpf_netdev.o", "2/1")
14✔
216
TEST_SECTION("cilium", "bpf_netdev.o", "2/3")
14✔
217
TEST_SECTION("cilium", "bpf_netdev.o", "2/4")
14✔
218
TEST_SECTION("cilium", "bpf_netdev.o", "2/5")
14✔
219
TEST_SECTION("cilium", "bpf_netdev.o", "2/7")
14✔
220

221
TEST_SECTION("cilium", "bpf_overlay.o", "2/1")
14✔
222
TEST_SECTION("cilium", "bpf_overlay.o", "2/3")
14✔
223
TEST_SECTION("cilium", "bpf_overlay.o", "2/4")
14✔
224
TEST_SECTION("cilium", "bpf_overlay.o", "2/5")
14✔
225
TEST_SECTION("cilium", "bpf_overlay.o", "2/7")
14✔
226
TEST_SECTION_LEGACY("cilium", "bpf_overlay.o", "from-overlay")
25✔
227

228
TEST_SECTION("cilium", "bpf_xdp.o", "from-netdev")
14✔
229

230
TEST_SECTION("cilium", "bpf_xdp_dsr_linux_v1_1.o", "from-netdev")
14✔
231
TEST_SECTION("cilium", "bpf_xdp_dsr_linux.o", "2/1")
14✔
232
TEST_SECTION("cilium", "bpf_xdp_dsr_linux.o", "from-netdev")
14✔
233

234
TEST_SECTION("cilium", "bpf_xdp_snat_linux.o", "2/1")
14✔
235
TEST_SECTION("cilium", "bpf_xdp_snat_linux.o", "from-netdev")
14✔
236

237
TEST_SECTION("linux", "cpustat_kern.o", "tracepoint/power/cpu_frequency")
14✔
238
TEST_SECTION("linux", "cpustat_kern.o", "tracepoint/power/cpu_idle")
14✔
239
TEST_SECTION("linux", "lathist_kern.o", "kprobe/trace_preempt_off")
14✔
240
TEST_SECTION("linux", "lathist_kern.o", "kprobe/trace_preempt_on")
14✔
241
TEST_SECTION("linux", "lwt_len_hist_kern.o", "len_hist")
14✔
242
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_getegid")
14✔
243
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_geteuid")
14✔
244
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_getgid")
14✔
245
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_getpgid")
14✔
246
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_getppid")
14✔
247
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_gettid")
14✔
248
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_getuid")
14✔
249
TEST_SECTION("linux", "offwaketime_kern.o", "kprobe/try_to_wake_up")
14✔
250
TEST_SECTION("linux", "offwaketime_kern.o", "tracepoint/sched/sched_switch")
14✔
251
TEST_SECTION("linux", "sampleip_kern.o", "perf_event")
14✔
252
TEST_SECTION("linux", "sock_flags_kern.o", "cgroup/sock1")
14✔
253
TEST_SECTION("linux", "sock_flags_kern.o", "cgroup/sock2")
14✔
254
TEST_SECTION_LEGACY("linux", "sockex1_kern.o", "socket1")
25✔
255
TEST_SECTION_LEGACY("linux", "sockex2_kern.o", "socket2")
25✔
256
TEST_SECTION_LEGACY("linux", "sockex3_kern.o", "socket/3")
25✔
257
TEST_SECTION_LEGACY("linux", "sockex3_kern.o", "socket/4")
25✔
258
TEST_SECTION_LEGACY("linux", "sockex3_kern.o", "socket/1")
25✔
259
TEST_SECTION_LEGACY("linux", "sockex3_kern.o", "socket/2")
25✔
260
TEST_SECTION_LEGACY("linux", "sockex3_kern.o", "socket/0")
25✔
261
TEST_SECTION("linux", "spintest_kern.o", "kprobe/__htab_percpu_map_update_elem")
14✔
262
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_lock")
14✔
263
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_lock_bh")
14✔
264
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_lock_irq")
14✔
265
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_lock_irqsave")
14✔
266
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_trylock_bh")
14✔
267
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_trylock")
14✔
268
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_unlock")
14✔
269
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_unlock_bh")
14✔
270
TEST_SECTION("linux", "spintest_kern.o", "kprobe/_raw_spin_unlock_irqrestore")
14✔
271
TEST_SECTION("linux", "spintest_kern.o", "kprobe/htab_map_alloc")
14✔
272
TEST_SECTION("linux", "spintest_kern.o", "kprobe/htab_map_update_elem")
14✔
273
TEST_SECTION("linux", "spintest_kern.o", "kprobe/mutex_spin_on_owner")
14✔
274
TEST_SECTION("linux", "spintest_kern.o", "kprobe/rwsem_spin_on_owner")
14✔
275
TEST_SECTION("linux", "spintest_kern.o", "kprobe/spin_lock")
14✔
276
TEST_SECTION("linux", "spintest_kern.o", "kprobe/spin_unlock")
14✔
277
TEST_SECTION("linux", "spintest_kern.o", "kprobe/spin_unlock_irqrestore")
14✔
278
TEST_SECTION("linux", "syscall_tp_kern.o", "tracepoint/syscalls/sys_enter_open")
14✔
279
TEST_SECTION("linux", "syscall_tp_kern.o", "tracepoint/syscalls/sys_exit_open")
14✔
280
TEST_SECTION("linux", "task_fd_query_kern.o", "kprobe/blk_start_request")
14✔
281
TEST_SECTION("linux", "task_fd_query_kern.o", "kretprobe/blk_account_io_completion")
14✔
282
TEST_SECTION("linux", "tc_l2_redirect_kern.o", "drop_non_tun_vip")
14✔
283
TEST_SECTION("linux", "tc_l2_redirect_kern.o", "l2_to_ip6tun_ingress_redirect")
14✔
284
TEST_SECTION("linux", "tc_l2_redirect_kern.o", "l2_to_iptun_ingress_forward")
14✔
285
TEST_SECTION("linux", "tc_l2_redirect_kern.o", "l2_to_iptun_ingress_redirect")
14✔
286
TEST_SECTION("linux", "tcp_basertt_kern.o", "sockops")
14✔
287
TEST_SECTION("linux", "tcp_bufs_kern.o", "sockops")
14✔
288
TEST_SECTION("linux", "tcp_cong_kern.o", "sockops")
14✔
289
TEST_SECTION("linux", "tcp_iw_kern.o", "sockops")
14✔
290
TEST_SECTION_LEGACY("linux", "tcbpf1_kern.o", "classifier")
25✔
291
TEST_SECTION("linux", "tcbpf1_kern.o", "clone_redirect_recv")
14✔
292
TEST_SECTION("linux", "tcbpf1_kern.o", "clone_redirect_xmit")
14✔
293
TEST_SECTION("linux", "tcbpf1_kern.o", "redirect_recv")
14✔
294
TEST_SECTION("linux", "tcbpf1_kern.o", "redirect_xmit")
14✔
295
TEST_SECTION("linux", "tcp_clamp_kern.o", "sockops")
14✔
296
TEST_SECTION("linux", "tcp_rwnd_kern.o", "sockops")
14✔
297
TEST_SECTION("linux", "tcp_synrto_kern.o", "sockops")
14✔
298
TEST_SECTION("linux", "test_cgrp2_tc_kern.o", "filter")
14✔
299
TEST_SECTION("linux", "test_current_task_under_cgroup_kern.o", "kprobe/sys_sync")
14✔
300
TEST_SECTION("linux", "test_overhead_kprobe_kern.o", "kprobe/__set_task_comm")
14✔
301
TEST_SECTION("linux", "test_overhead_kprobe_kern.o", "kprobe/urandom_read")
14✔
302
TEST_SECTION("linux", "test_overhead_raw_tp_kern.o", "raw_tracepoint/task_rename")
14✔
303
TEST_SECTION("linux", "test_overhead_raw_tp_kern.o", "raw_tracepoint/urandom_read")
14✔
304
TEST_SECTION("linux", "test_overhead_tp_kern.o", "tracepoint/random/urandom_read")
14✔
305
TEST_SECTION("linux", "test_overhead_tp_kern.o", "tracepoint/task/task_rename")
14✔
306
TEST_SECTION("linux", "test_probe_write_user_kern.o", "kprobe/sys_connect")
14✔
307
TEST_SECTION("linux", "trace_event_kern.o", "perf_event")
14✔
308
TEST_SECTION("linux", "trace_output_kern.o", "kprobe/sys_write")
14✔
309
TEST_SECTION("linux", "tracex1_kern.o", "kprobe/__netif_receive_skb_core")
14✔
310
TEST_SECTION("linux", "tracex2_kern.o", "kprobe/kfree_skb")
14✔
311
TEST_SECTION("linux", "tracex2_kern.o", "kprobe/sys_write")
14✔
312
TEST_SECTION("linux", "tracex3_kern.o", "kprobe/blk_account_io_completion")
14✔
313
TEST_SECTION("linux", "tracex3_kern.o", "kprobe/blk_start_request")
14✔
314
TEST_SECTION("linux", "tracex4_kern.o", "kprobe/kmem_cache_free")
14✔
315
TEST_SECTION("linux", "tracex4_kern.o", "kretprobe/kmem_cache_alloc_node")
14✔
316
TEST_SECTION("linux", "tracex5_kern.o", "kprobe/__seccomp_filter")
14✔
317
TEST_SECTION("linux", "tracex5_kern.o", "kprobe/0")
14✔
318
TEST_SECTION("linux", "tracex5_kern.o", "kprobe/1")
14✔
319
TEST_SECTION("linux", "tracex5_kern.o", "kprobe/9")
14✔
320
TEST_SECTION("linux", "tracex6_kern.o", "kprobe/htab_map_get_next_key")
14✔
321
TEST_SECTION("linux", "tracex6_kern.o", "kprobe/htab_map_lookup_elem")
14✔
322
TEST_SECTION("linux", "tracex7_kern.o", "kprobe/open_ctree")
14✔
323
TEST_SECTION("linux", "xdp_adjust_tail_kern.o", "xdp_icmp")
14✔
324
TEST_SECTION("linux", "xdp_fwd_kern.o", "xdp_fwd")
14✔
325
TEST_SECTION("linux", "xdp_fwd_kern.o", "xdp_fwd_direct")
14✔
326
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_cpumap_enqueue")
14✔
327
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_cpumap_kthread")
14✔
328
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_devmap_xmit")
14✔
329
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_exception")
14✔
330
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect")
14✔
331
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_err")
14✔
332
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_map")
14✔
333
TEST_SECTION("linux", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_map_err")
14✔
334
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map0")
14✔
335
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map1_touch_data")
14✔
336
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map2_round_robin")
14✔
337
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map3_proto_separate")
14✔
338
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map4_ddos_filter_pktgen")
14✔
339
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "xdp_cpu_map5_lb_hash_ip_pairs")
14✔
340
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_cpumap_enqueue")
14✔
341
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_cpumap_kthread")
14✔
342
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_exception")
14✔
343
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_redirect_err")
14✔
344
TEST_SECTION("linux", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_redirect_map_err")
14✔
345
TEST_SECTION("linux", "xdp_redirect_kern.o", "xdp_redirect")
14✔
346
TEST_SECTION("linux", "xdp_redirect_kern.o", "xdp_redirect_dummy")
14✔
347
TEST_SECTION("linux", "xdp_redirect_map_kern.o", "xdp_redirect_dummy")
14✔
348
TEST_SECTION("linux", "xdp_redirect_map_kern.o", "xdp_redirect_map")
14✔
349
TEST_SECTION("linux", "xdp_router_ipv4_kern.o", "xdp_router_ipv4")
14✔
350
TEST_SECTION("linux", "xdp_rxq_info_kern.o", "xdp_prog0")
14✔
351
TEST_SECTION("linux", "xdp_sample_pkts_kern.o", "xdp_sample")
14✔
352
TEST_SECTION("linux", "xdp_tx_iptunnel_kern.o", "xdp_tx_iptunnel")
14✔
353
TEST_SECTION("linux", "xdp1_kern.o", "xdp1")
14✔
354
TEST_SECTION("linux", "xdp2_kern.o", "xdp1")
14✔
355
TEST_SECTION("linux", "xdp2skb_meta_kern.o", "tc_mark")
14✔
356
TEST_SECTION("linux", "xdp2skb_meta_kern.o", "xdp_mark")
14✔
357
TEST_SECTION("linux", "xdpsock_kern.o", "xdp_sock")
14✔
358
// Finally passes; still requires double-check
359
TEST_SECTION("linux", "map_perf_test_kern.o", "kprobe/sys_connect")
14✔
360

361
TEST_SECTION("prototype-kernel", "napi_monitor_kern.o", "tracepoint/irq/softirq_entry")
14✔
362
TEST_SECTION("prototype-kernel", "napi_monitor_kern.o", "tracepoint/irq/softirq_exit")
14✔
363
TEST_SECTION("prototype-kernel", "napi_monitor_kern.o", "tracepoint/irq/softirq_raise")
14✔
364
TEST_SECTION("prototype-kernel", "napi_monitor_kern.o", "tracepoint/napi/napi_poll")
14✔
365
TEST_SECTION("prototype-kernel", "tc_bench01_redirect_kern.o", "ingress_redirect")
14✔
366
TEST_SECTION("prototype-kernel", "xdp_bench01_mem_access_cost_kern.o", "xdp_bench01")
14✔
367
TEST_SECTION("prototype-kernel", "xdp_bench02_drop_pattern_kern.o", "xdp_bench02")
14✔
368
TEST_SECTION("prototype-kernel", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect")
14✔
369
TEST_SECTION("prototype-kernel", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_err")
14✔
370
TEST_SECTION("prototype-kernel", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_map_err")
14✔
371
TEST_SECTION("prototype-kernel", "xdp_monitor_kern.o", "tracepoint/xdp/xdp_redirect_map")
14✔
372
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map0")
14✔
373
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map2_round_robin")
14✔
374
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_cpumap_enqueue")
14✔
375
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_cpumap_kthread")
14✔
376
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_exception")
14✔
377
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_redirect_err")
14✔
378
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "tracepoint/xdp/xdp_redirect_map_err")
14✔
379
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map1_touch_data")
14✔
380
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map3_proto_separate")
14✔
381
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map4_ddos_filter_pktgen")
14✔
382
TEST_SECTION("prototype-kernel", "xdp_redirect_cpu_kern.o", "xdp_cpu_map5_ip_l3_flow_hash")
14✔
383
TEST_SECTION("prototype-kernel", "xdp_redirect_err_kern.o", "xdp_redirect_dummy")
14✔
384
TEST_SECTION("prototype-kernel", "xdp_redirect_err_kern.o", "xdp_redirect_map")
14✔
385
TEST_SECTION("prototype-kernel", "xdp_redirect_err_kern.o", "xdp_redirect_map_rr")
14✔
386
TEST_SECTION("prototype-kernel", "xdp_tcpdump_kern.o", "xdp_tcpdump_to_perf_ring")
14✔
387
TEST_SECTION("prototype-kernel", "xdp_ttl_kern.o", "xdp_ttl")
14✔
388
TEST_SECTION("prototype-kernel", "xdp_vlan01_kern.o", "tc_vlan_push")
14✔
389
TEST_SECTION("prototype-kernel", "xdp_vlan01_kern.o", "xdp_drop_vlan_4011")
14✔
390
TEST_SECTION("prototype-kernel", "xdp_vlan01_kern.o", "xdp_vlan_change")
14✔
391
TEST_SECTION("prototype-kernel", "xdp_vlan01_kern.o", "xdp_vlan_remove_outer")
14✔
392
TEST_SECTION("prototype-kernel", "xdp_vlan01_kern.o", "xdp_vlan_remove_outer2")
14✔
393

394
TEST_SECTION("ovs", "datapath.o", "tail-0")
14✔
395
TEST_SECTION("ovs", "datapath.o", "tail-1")
14✔
396
TEST_SECTION("ovs", "datapath.o", "tail-2")
14✔
397
TEST_SECTION_LEGACY("ovs", "datapath.o", "tail-3")
25✔
398
TEST_SECTION("ovs", "datapath.o", "tail-4")
14✔
399
TEST_SECTION("ovs", "datapath.o", "tail-5")
14✔
400
TEST_SECTION("ovs", "datapath.o", "tail-7")
14✔
401
TEST_SECTION("ovs", "datapath.o", "tail-8")
14✔
402
TEST_SECTION("ovs", "datapath.o", "tail-11")
14✔
403
TEST_SECTION("ovs", "datapath.o", "tail-12")
14✔
404
TEST_SECTION("ovs", "datapath.o", "tail-13")
14✔
405
TEST_SECTION_LEGACY("ovs", "datapath.o", "tail-32")
25✔
406
TEST_SECTION("ovs", "datapath.o", "tail-33")
14✔
407
TEST_SECTION("ovs", "datapath.o", "tail-35")
14✔
408
TEST_SECTION("ovs", "datapath.o", "af_xdp")
14✔
409
TEST_SECTION("ovs", "datapath.o", "downcall")
14✔
410
TEST_SECTION("ovs", "datapath.o", "egress")
14✔
411
TEST_SECTION("ovs", "datapath.o", "ingress")
14✔
412
TEST_SECTION("ovs", "datapath.o", "xdp")
14✔
413

414
TEST_SECTION_LEGACY("suricata", "bypass_filter.o", "filter")
25✔
415
TEST_SECTION_LEGACY("suricata", "lb.o", "loadbalancer")
25✔
416
TEST_SECTION("suricata", "filter.o", "filter")
14✔
417
TEST_SECTION("suricata", "vlan_filter.o", "filter")
14✔
418
TEST_SECTION("suricata", "xdp_filter.o", "xdp")
14✔
419

420
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_accept4_e")
14✔
421
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_empty")
14✔
422
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_pread64_e")
14✔
423
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_preadv64_e")
14✔
424
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_pwrite64_e")
14✔
425
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_single_x")
14✔
426
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/sys_sysdigevent_e")
14✔
427
TEST_SECTION("falco", "probe.o", "raw_tracepoint/filler/terminate_filler")
14✔
428
TEST_SECTION("falco", "probe.o", "raw_tracepoint/page_fault_kernel")
14✔
429
TEST_SECTION("falco", "probe.o", "raw_tracepoint/page_fault_user")
14✔
430
TEST_SECTION("falco", "probe.o", "raw_tracepoint/sched_switch")
14✔
431
TEST_SECTION("falco", "probe.o", "raw_tracepoint/signal_deliver")
14✔
432

433
// Test some programs that should pass verification except when the strict flag is set.
434
TEST_SECTION_REJECT_IF_STRICT("build", "mapoverflow.o", ".text")
26✔
435
TEST_SECTION_REJECT_IF_STRICT("build", "mapunderflow.o", ".text")
26✔
436

437
/*
438
 * These programs contain "call -1" instruction and cannot be verified:
439
TEST_SECTION("raw_tracepoint/filler/sys_access_e")
440
TEST_SECTION("raw_tracepoint/filler/sys_bpf_x")
441
TEST_SECTION("raw_tracepoint/filler/sys_brk_munmap_mmap_x")
442
TEST_SECTION("raw_tracepoint/filler/sys_eventfd_e")
443
TEST_SECTION("raw_tracepoint/filler/sys_execve_e")
444
TEST_SECTION("raw_tracepoint/filler/sys_generic")
445
TEST_SECTION("raw_tracepoint/filler/sys_getrlimit_setrlimit_e")
446
TEST_SECTION("raw_tracepoint/filler/sys_getrlimit_setrlrimit_x")
447
TEST_SECTION("raw_tracepoint/filler/sys_mount_e")
448
TEST_SECTION("raw_tracepoint/filler/sys_nanosleep_e")
449
TEST_SECTION("raw_tracepoint/filler/sys_pagefault_e")
450
TEST_SECTION("raw_tracepoint/filler/sys_procexit_e")
451
TEST_SECTION("raw_tracepoint/filler/sys_single")
452
TEST_SECTION("raw_tracepoint/filler/sys_unshare_e")
453
TEST_SECTION("raw_tracepoint/sched_process_exit")
454
TEST_SECTION("raw_tracepoint/filler/sys_chmod_x")
455
TEST_SECTION("raw_tracepoint/filler/sys_fchmod_x")
456
TEST_SECTION("raw_tracepoint/filler/sys_fcntl_e")
457
TEST_SECTION("raw_tracepoint/filler/sys_flock_e")
458
TEST_SECTION("raw_tracepoint/filler/sys_poll_x")
459
TEST_SECTION("raw_tracepoint/filler/sys_prlimit_e")
460
TEST_SECTION("raw_tracepoint/filler/sys_prlimit_x")
461
TEST_SECTION("raw_tracepoint/filler/sys_ptrace_e")
462
TEST_SECTION("raw_tracepoint/filler/sys_quotactl_e")
463
TEST_SECTION("raw_tracepoint/filler/sys_semop_x")
464
TEST_SECTION("raw_tracepoint/filler/sys_send_e")
465
TEST_SECTION("raw_tracepoint/filler/sys_sendfile_x")
466
TEST_SECTION("raw_tracepoint/filler/sys_setns_e")
467
TEST_SECTION("raw_tracepoint/filler/sys_shutdown_e")
468
TEST_SECTION("raw_tracepoint/filler/sys_fchmodat_x")
469
TEST_SECTION("raw_tracepoint/filler/sys_futex_e")
470
TEST_SECTION("raw_tracepoint/filler/sys_lseek_e")
471
TEST_SECTION("raw_tracepoint/filler/sys_mkdirat_x")
472
TEST_SECTION("raw_tracepoint/filler/sys_poll_e")
473
TEST_SECTION("raw_tracepoint/filler/sys_ptrace_x")
474
TEST_SECTION("raw_tracepoint/filler/sys_quotactl_x")
475
TEST_SECTION("raw_tracepoint/filler/sys_semget_e")
476
TEST_SECTION("raw_tracepoint/filler/sys_signaldeliver_e")
477
TEST_SECTION("raw_tracepoint/filler/sys_symlinkat_x")
478
TEST_SECTION("raw_tracepoint/filler/sys_unlinkat_x")
479
TEST_SECTION("raw_tracepoint/filler/sys_writev_e")
480
TEST_SECTION("raw_tracepoint/filler/sys_llseek_e")
481
TEST_SECTION("raw_tracepoint/filler/sys_ppoll_e")
482
TEST_SECTION("raw_tracepoint/filler/sys_pwritev_e")
483
TEST_SECTION("raw_tracepoint/filler/sys_renameat_x")
484
TEST_SECTION("raw_tracepoint/filler/sys_semctl_e")
485
TEST_SECTION("raw_tracepoint/filler/sched_switch_e")
486
TEST_SECTION("raw_tracepoint/filler/sys_getsockopt_x")
487
TEST_SECTION("raw_tracepoint/filler/sys_linkat_x")
488
TEST_SECTION("raw_tracepoint/filler/sys_renameat2_x")
489
TEST_SECTION("raw_tracepoint/filler/sys_sendfile_e")
490
TEST_SECTION("raw_tracepoint/filler/sys_setsockopt_x")
491
TEST_SECTION("raw_tracepoint/filler/sys_getresuid_and_gid_x")
492
TEST_SECTION("raw_tracepoint/filler/sys_mmap_e")
493
TEST_SECTION("raw_tracepoint/filler/sys_socket_bind_x")
494
TEST_SECTION("raw_tracepoint/filler/sys_socket_x")
495
TEST_SECTION("raw_tracepoint/sys_enter")
496
TEST_SECTION("raw_tracepoint/sys_exit")
497
TEST_SECTION("raw_tracepoint/filler/sys_pipe_x")
498
TEST_SECTION("raw_tracepoint/filler/sys_socketpair_x")
499
TEST_SECTION("raw_tracepoint/filler/sys_creat_x")
500
TEST_SECTION("raw_tracepoint/filler/sys_open_x")
501
TEST_SECTION("raw_tracepoint/filler/sys_openat_x")
502
TEST_SECTION("raw_tracepoint/filler/sys_autofill")
503
TEST_SECTION("raw_tracepoint/filler/proc_startupdate")
504
TEST_SECTION("raw_tracepoint/filler/sys_recvmsg_x_2")
505
TEST_SECTION("raw_tracepoint/filler/sys_sendmsg_e")
506
TEST_SECTION("raw_tracepoint/filler/sys_connect_x")
507
TEST_SECTION("raw_tracepoint/filler/sys_sendto_e")
508
TEST_SECTION("raw_tracepoint/filler/sys_accept_x")
509
TEST_SECTION("raw_tracepoint/filler/sys_read_x")
510
TEST_SECTION("raw_tracepoint/filler/sys_recv_x")
511
TEST_SECTION("raw_tracepoint/filler/sys_recvmsg_x")
512
TEST_SECTION("raw_tracepoint/filler/sys_send_x")
513
TEST_SECTION("raw_tracepoint/filler/proc_startupdate_3")
514
TEST_SECTION("raw_tracepoint/filler/sys_readv_preadv_x")
515
TEST_SECTION("raw_tracepoint/filler/sys_write_x")
516
TEST_SECTION("raw_tracepoint/filler/sys_writev_pwritev_x")
517
TEST_SECTION("raw_tracepoint/filler/sys_sendmsg_x")
518
TEST_SECTION("raw_tracepoint/filler/proc_startupdate_2")
519
TEST_SECTION("raw_tracepoint/filler/sys_recvfrom_x")
520
*/
521

522
TEST_PROGRAM("build", "bpf2bpf.o", ".text", "add1", 2);
17✔
523
TEST_PROGRAM("build", "bpf2bpf.o", ".text", "add2", 2);
17✔
524
TEST_PROGRAM("build", "bpf2bpf.o", "test", "func", 1);
14✔
525

526
TEST_SECTION("build", "byteswap.o", ".text")
14✔
527
TEST_SECTION("build", "stackok.o", ".text")
14✔
528
TEST_SECTION("build", "packet_start_ok.o", "xdp")
14✔
529
TEST_SECTION("build", "packet_access.o", "xdp")
14✔
530
TEST_SECTION("build", "tail_call.o", "xdp_prog")
14✔
531
TEST_SECTION("build", "map_in_map.o", ".text")
14✔
532
TEST_SECTION("build", "map_in_map_anonymous.o", ".text")
14✔
533
TEST_SECTION("build", "map_in_map_legacy.o", ".text")
14✔
534
TEST_SECTION("build", "store_map_value_in_map.o", ".text")
14✔
535
TEST_SECTION("build", "twomaps.o", ".text");
14✔
536
TEST_SECTION("build", "twostackvars.o", ".text");
14✔
537
TEST_SECTION("build", "twotypes.o", ".text");
14✔
538
TEST_SECTION("build", "global_variable.o", ".text")
14✔
539
TEST_PROGRAM("build", "prog_array.o", ".text", "func", 5);
23✔
540
TEST_PROGRAM("build", "prog_array.o", ".text", "func0", 5);
23✔
541
TEST_PROGRAM("build", "prog_array.o", ".text", "func1", 5);
23✔
542
TEST_PROGRAM("build", "prog_array.o", ".text", "func2", 5);
23✔
543
TEST_PROGRAM("build", "prog_array.o", ".text", "func3", 5);
23✔
544

545
// Test some programs that ought to fail verification.
546
TEST_SECTION_REJECT("build", "badmapptr.o", "test")
14✔
547
TEST_SECTION_REJECT("build", "badhelpercall.o", ".text")
14✔
548
TEST_SECTION_REJECT("build", "ctxoffset.o", "sockops")
14✔
549
TEST_SECTION_FAIL("build", "dependent_read.o", "xdp")
17✔
550
TEST_SECTION_REJECT("build", "exposeptr.o", ".text")
14✔
551
TEST_SECTION_REJECT("build", "exposeptr2.o", ".text")
14✔
552
TEST_SECTION_REJECT("build", "mapvalue-overrun.o", ".text")
14✔
553
TEST_SECTION_REJECT("build", "nullmapref.o", "test")
14✔
554
TEST_SECTION_REJECT("build", "packet_overflow.o", "xdp")
14✔
555
TEST_SECTION_REJECT("build", "packet_reallocate.o", "socket_filter")
14✔
556
TEST_SECTION_REJECT("build", "tail_call_bad.o", "xdp_prog")
14✔
557
TEST_SECTION_REJECT("build", "ringbuf_uninit.o", ".text");
14✔
558

559
// The following eBPF programs currently fail verification.
560
// If the verifier is later updated to accept them, these should
561
// be changed to TEST_SECTION().
562

563
// This fails due to correlated branches not being handled precisely enough,
564
// Unless the analysis tracks the correlation between shared_offset and the type of another register,
565
// which is probably arbitrary and brittle.
566
TEST_SECTION_FAIL("prototype-kernel", "xdp_ddos01_blacklist_kern.o", "xdp_prog")
17✔
567

568
// Unsupported: ebpf-function
569
TEST_SECTION_FAIL("prototype-kernel", "xdp_ddos01_blacklist_kern.o", ".text")
17✔
570

571
// Unsupported: implications are lost in correlated branches
572
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/7")
17✔
573

574
// Failure: 166:168: Upper bound must be at most packet_size (valid_access(r4.offset, width=2) for read)
575
// This is the result of merging two branches, one with value 0 and another with value -22,
576
// then checking that the result is != 0. The minor issue is not handling the int32 comparison precisely enough.
577
// The bigger issue is that the convexity of the numerical domain means that precise handling would still get
578
// [-22, -1] which is not sufficient (at most -2 is needed)
579
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/10")
17✔
580
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/21")
17✔
581
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_dsr_linux.o", "2/24")
17✔
582

583
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_dsr_linux.o", "2/15")
17✔
584

585
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/17")
17✔
586

587
// Failure: trying to access r4 where r4.packet_offset=[0, 255] and packet_size=[54, 65534]
588
// Root cause: r5.value=[0, 65535] 209: w5 >>= 8; clears r5 instead of yielding [0, 255]
589
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/18")
17✔
590
TEST_SECTION_FAIL("cilium", "bpf_xdp_snat_linux.o", "2/10")
17✔
591
TEST_SECTION_FAIL("cilium", "bpf_xdp_snat_linux.o", "2/18")
17✔
592

593
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_dsr_linux.o", "2/19")
17✔
594

595
// Failure: 230: Upper bound must be at most packet_size (valid_access(r3.offset+32, width=8) for write)
596
// r3.packet_offset=[0, 82] and packet_size=[34, 65534]
597
// looks like a combination of misunderstanding the value passed to xdp_adjust_tail()
598
// which is "r7.value=[0, 82]; w7 -= r9;" where r9.value where "r7.value-r9.value<=48"
599
TEST_SECTION_FAIL("cilium", "bpf_xdp_dsr_linux.o", "2/20")
17✔
600

601
TEST_SECTION_FAIL("cilium", "bpf_xdp_snat_linux.o", "2/7")
17✔
602
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_snat_linux.o", "2/15")
17✔
603
TEST_SECTION_FAIL("cilium", "bpf_xdp_snat_linux.o", "2/17")
17✔
604
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_snat_linux.o", "2/19")
17✔
605

606
// Failure (&255): assert r5.type == number; w5 &= 255;
607
// fails since in one branch (77) r5 is a number but in another (92:93) it is a packet
608
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_snat_linux.o", "2/24")
17✔
609
// Failure (&255): assert r3.type == number; w3 &= 255;
610
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_dsr_linux.o", "2/16")
17✔
611
TEST_SECTION_FAIL_SLOW("cilium", "bpf_xdp_snat_linux.o", "2/16")
17✔
612

613
// False positive, unknown cause
614
TEST_SECTION_FAIL("linux", "test_map_in_map_kern.o", "kprobe/sys_connect")
17✔
615

616
TEST_SECTION_LEGACY("cilium", "bpf_netdev.o", "from-netdev")
25✔
617
TEST_SECTION_LEGACY_SLOW("bpf_cilium_test", "bpf_netdev.o", "from-netdev")
25✔
618
TEST_SECTION_SLOW("cilium", "bpf_lxc.o", "2/7")
14✔
619
TEST_SECTION_LEGACY_SLOW("cilium", "bpf_lxc.o", "2/10")
25✔
620
TEST_SECTION_SLOW("cilium", "bpf_lxc.o", "2/11")
14✔
621
TEST_SECTION_SLOW("cilium", "bpf_lxc.o", "2/12")
14✔
622

623
// cilium-core/bpf_host.o
624
TEST_PROGRAM_FAIL("cilium-core", "bpf_host.o", "tc/entry", "cil_from_netdev", 5)
18✔
625
TEST_PROGRAM_FAIL("cilium-core", "bpf_host.o", "tc/entry", "cil_from_host", 5)
20✔
626
TEST_PROGRAM_FAIL("cilium-core", "bpf_host.o", "tc/entry", "cil_to_netdev", 5)
22✔
627
// - cil_to_host: unsupported function: skc_lookup_tcp
628
TEST_PROGRAM_FAIL("cilium-core", "bpf_host.o", "tc/entry", "cil_host_policy", 5)
26✔
629

630
// cilium-core/bpf_lxc.o
631
TEST_PROGRAM("cilium-core", "bpf_lxc.o", "tc/entry", "cil_from_container", 4)
21✔
632
TEST_PROGRAM("cilium-core", "bpf_lxc.o", "tc/entry", "cil_lxc_policy", 4)
21✔
633
TEST_PROGRAM("cilium-core", "bpf_lxc.o", "tc/entry", "cil_lxc_policy_egress", 4)
21✔
634
TEST_PROGRAM("cilium-core", "bpf_lxc.o", "tc/entry", "cil_to_container", 4)
21✔
635

636
// cilium-core/bpf_network.o
637
TEST_SECTION("cilium-core", "bpf_network.o", "tc/entry")
14✔
638

639
// cilium-core/bpf_overlay.o
640
TEST_PROGRAM("cilium-core", "bpf_overlay.o", "tc/entry", "cil_from_overlay", 2)
17✔
641
// - cil_to_overlay: CRAB_ERROR("Bound: inf / inf")
642

643
// cilium-core/bpf_sock.o
644
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/connect4")
14✔
645
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/connect6")
14✔
646
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/post_bind4")
14✔
647
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/post_bind6")
14✔
648
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/sendmsg4")
14✔
649
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/sendmsg6")
14✔
650
TEST_SECTION("cilium-core", "bpf_sock.o", "cgroup/recvmsg4")
14✔
651
TEST_SECTION_FAIL("cilium-core", "bpf_sock.o", "cgroup/recvmsg6")
17✔
652
// - bpf_sock.o cgroup/sock_release: invalid helper function id 46
653

654
// cilium-core/bpf_wireguard.o
655
TEST_PROGRAM("cilium-core", "bpf_wireguard.o", "tc/entry", "cil_from_wireguard", 2)
17✔
656
TEST_PROGRAM("cilium-core", "bpf_wireguard.o", "tc/entry", "cil_to_wireguard", 2)
17✔
657

658
// cilium-core/bpf_xdp.o
659
TEST_SECTION_FAIL("cilium-core", "bpf_xdp.o", "xdp/entry")
17✔
660

661
// cilium-examples tests
662
TEST_SECTION("cilium-examples", "cgroup_skb_bpf_bpfel.o", "cgroup_skb/egress")
14✔
663
TEST_SECTION("cilium-examples", "kprobe_bpf_bpfel.o", "kprobe/sys_execve")
14✔
664
TEST_SECTION("cilium-examples", "kprobe_percpu_bpf_bpfel.o", "kprobe/sys_execve")
14✔
665
TEST_SECTION("cilium-examples", "kprobepin_bpf_bpfel.o", "kprobe/sys_execve")
14✔
666
TEST_SECTION("cilium-examples", "tracepoint_in_c_bpf_bpfel.o", "tracepoint/kmem/mm_page_alloc")
14✔
667
TEST_SECTION("cilium-examples", "xdp_bpf_bpfel.o", "xdp")
14✔
668
// This is TEST_SECTION_FAIL, but with a shorter filename to avoid CATCH2 test name limits.
669
TEST_CASE("expect failure cilium-examples/uretprobe_x86 uretprobe/bash_readline",
2✔
670
          "[!shouldfail][verify][samples][cilium-examples]") {
671
    VERIFY_SECTION("cilium-examples", "uretprobe_bpf_x86_bpfel.o", "uretprobe/bash_readline", {},
17✔
672
                   &g_ebpf_platform_linux, true);
673
}
×
674

675
TEST_PROGRAM("cilium-examples", "tcx_bpf_bpfel.o", "tc", "ingress_prog_func", 2)
17✔
676
TEST_PROGRAM("cilium-examples", "tcx_bpf_bpfel.o", "tc", "egress_prog_func", 2)
17✔
677

678
static void test_analyze_thread(const Program* prog, const ProgramInfo* info, bool* res) {
4✔
679
    thread_local_program_info.set(*info);
6✔
680
    *res = verify(*prog);
4✔
681
}
4✔
682

683
// Test multithreading
684
TEST_CASE("multithreading", "[verify][multithreading]") {
2✔
685
    auto raw_progs1 = read_elf("ebpf-samples/bpf_cilium_test/bpf_netdev.o", "2/1", {}, &g_ebpf_platform_linux);
6✔
686
    REQUIRE(raw_progs1.size() == 1);
2✔
687
    RawProgram raw_prog1 = raw_progs1.back();
2✔
688
    auto prog_or_error1 = unmarshal(raw_prog1);
2✔
689
    auto inst_seq1 = std::get_if<InstructionSeq>(&prog_or_error1);
2✔
690
    REQUIRE(inst_seq1);
2✔
691
    const Program prog1 = Program::from_sequence(*inst_seq1, raw_prog1.info, {});
2✔
692

693
    auto raw_progs2 = read_elf("ebpf-samples/bpf_cilium_test/bpf_netdev.o", "2/2", {}, &g_ebpf_platform_linux);
6✔
694
    REQUIRE(raw_progs2.size() == 1);
2✔
695
    RawProgram raw_prog2 = raw_progs2.back();
2✔
696
    auto prog_or_error2 = unmarshal(raw_prog2);
2✔
697
    auto inst_seq2 = std::get_if<InstructionSeq>(&prog_or_error2);
2✔
698
    REQUIRE(inst_seq2);
2✔
699
    const Program prog2 = Program::from_sequence(*inst_seq2, raw_prog2.info, {});
2✔
700

701
    bool res1, res2;
1✔
702
    std::thread a(test_analyze_thread, &prog1, &raw_prog1.info, &res1);
2✔
703
    std::thread b(test_analyze_thread, &prog2, &raw_prog2.info, &res2);
2✔
704
    a.join();
2✔
705
    b.join();
2✔
706

707
    REQUIRE(res1);
2✔
708
    REQUIRE(res2);
3✔
709
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc