• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

benchs/11-Mar-2024-1,119913

gnu/11-Mar-2024-20

map_tests/11-Mar-2024-1,047838

prog_tests/11-Mar-2024-32,38925,885

progs/11-Mar-2024-27,22620,408

verifier/11-Mar-2024-21,46920,621

.gitignoreD11-Mar-2024577 3938

MakefileD11-Mar-202416.1 KiB463346

README.rstD11-Mar-20243.3 KiB10581

bench.cD11-Mar-202411.5 KiB465396

bench.hD11-Mar-20241.6 KiB8267

bpf_legacy.hD11-Mar-2024781 2617

bpf_rand.hD11-Mar-20243.1 KiB8172

bpf_rlimit.hD11-Mar-2024907 2916

bpf_tcp_helpers.hD11-Mar-20246.5 KiB233179

bpf_util.hD11-Mar-20241 KiB4433

cgroup_helpers.cD11-Mar-20247.5 KiB316199

cgroup_helpers.hD11-Mar-2024584 2014

configD11-Mar-2024826 4241

flow_dissector_load.cD11-Mar-20242.3 KiB11090

flow_dissector_load.hD11-Mar-20241.4 KiB7459

get_cgroup_id_user.cD11-Mar-20243.6 KiB140110

netcnt_common.hD11-Mar-2024320 2516

network_helpers.cD11-Mar-20245.2 KiB246199

network_helpers.hD11-Mar-20241.1 KiB4637

settingsD11-Mar-202410 21

tcp_client.pyD11-Mar-2024906 5137

tcp_server.pyD11-Mar-20241.7 KiB8161

test_bpftool.pyD11-Mar-20245.4 KiB179130

test_bpftool.shD11-Mar-2024127 61

test_bpftool_build.shD11-Mar-20244 KiB169113

test_bpftool_metadata.shD11-Mar-20241.6 KiB8355

test_btf.hD11-Mar-20242.3 KiB7048

test_cgroup_storage.cD11-Mar-20244.6 KiB171132

test_cpp.cppD11-Mar-2024572 3116

test_current_pid_tgid_new_ns.cD11-Mar-20243.9 KiB161130

test_dev_cgroup.cD11-Mar-20242 KiB8354

test_flow_dissector.cD11-Mar-202418.2 KiB781642

test_flow_dissector.shD11-Mar-20245.1 KiB169103

test_ftrace.shD11-Mar-2024701 4027

test_iptunnel_common.hD11-Mar-2024457 3526

test_kmod.shD11-Mar-20241.3 KiB6853

test_lirc_mode2.shD11-Mar-2024736 3929

test_lirc_mode2_user.cD11-Mar-20244.3 KiB177118

test_lpm_map.cD11-Mar-202422.9 KiB805571

test_lru_map.cD11-Mar-202423.4 KiB904579

test_lwt_ip_encap.shD11-Mar-202413.9 KiB465327

test_lwt_seg6local.shD11-Mar-20245.7 KiB150102

test_maps.cD11-Mar-202446.1 KiB1,7771,350

test_maps.hD11-Mar-2024350 1813

test_netcnt.cD11-Mar-20243.4 KiB149115

test_offload.pyD11-Mar-202450.6 KiB1,4071,134

test_progs.cD11-Mar-202415.7 KiB752599

test_progs.hD11-Mar-20245.5 KiB218188

test_select_reuseport_common.hD11-Mar-2024587 3727

test_skb_cgroup_id.shD11-Mar-20241.3 KiB6449

test_skb_cgroup_id_user.cD11-Mar-20243.5 KiB182144

test_sock.cD11-Mar-20249.1 KiB482424

test_sock_addr.cD11-Mar-202438 KiB1,6561,358

test_sock_addr.shD11-Mar-20241.1 KiB5947

test_socket_cookie.cD11-Mar-20243.8 KiB209166

test_sockmap.cD11-Mar-202443.3 KiB2,0171,707

test_stub.cD11-Mar-20241.3 KiB4534

test_sysctl.cD11-Mar-202440.2 KiB1,6371,147

test_tag.cD11-Mar-20244.2 KiB203163

test_tc_edt.shD11-Mar-20242.7 KiB10065

test_tc_redirect.shD11-Mar-20247 KiB217158

test_tc_tunnel.shD11-Mar-20247.3 KiB296214

test_tcp_check_syncookie.shD11-Mar-20241.7 KiB8566

test_tcp_check_syncookie_user.cD11-Mar-20244.8 KiB258204

test_tcp_hdr_options.hD11-Mar-20243.3 KiB153125

test_tcpbpf.hD11-Mar-2024335 1915

test_tcpbpf_user.cD11-Mar-20243.9 KiB166137

test_tcpnotify.hD11-Mar-2024273 2014

test_tcpnotify_user.cD11-Mar-20243.7 KiB170141

test_tunnel.shD11-Mar-202418.1 KiB764580

test_verifier.cD11-Mar-202432 KiB1,2351,046

test_verifier_log.cD11-Mar-20243.8 KiB175138

test_xdp_meta.shD11-Mar-20241.2 KiB5337

test_xdp_redirect.shD11-Mar-20241.7 KiB8252

test_xdp_veth.shD11-Mar-20243 KiB11978

test_xdp_vlan.shD11-Mar-20245.6 KiB229149

test_xdp_vlan_mode_generic.shD11-Mar-2024186 103

test_xdp_vlan_mode_native.shD11-Mar-2024180 103

test_xdping.shD11-Mar-20242 KiB10052

testing_helpers.cD11-Mar-20241.5 KiB8167

testing_helpers.hD11-Mar-2024308 95

trace_helpers.cD11-Mar-20242.4 KiB139108

trace_helpers.hD11-Mar-2024435 2213

urandom_read.cD11-Mar-2024552 3627

with_addr.shD11-Mar-20241.3 KiB5540

with_tunnels.shD11-Mar-2024693 3723

xdping.cD11-Mar-20245.8 KiB259207

xdping.hD11-Mar-2024283 149

README.rst

1==================
2BPF Selftest Notes
3==================
4General instructions on running selftests can be found in
5`Documentation/bpf/bpf_devel_QA.rst`_.
6
7Additional information about selftest failures are
8documented here.
9
10profiler[23] test failures with clang/llvm <12.0.0
11==================================================
12
13With clang/llvm <12.0.0, the profiler[23] test may fail.
14The symptom looks like
15
16.. code-block:: c
17
18  // r9 is a pointer to map_value
19  // r7 is a scalar
20  17:       bf 96 00 00 00 00 00 00 r6 = r9
21  18:       0f 76 00 00 00 00 00 00 r6 += r7
22  math between map_value pointer and register with unbounded min value is not allowed
23
24  // the instructions below will not be seen in the verifier log
25  19:       a5 07 01 00 01 01 00 00 if r7 < 257 goto +1
26  20:       bf 96 00 00 00 00 00 00 r6 = r9
27  // r6 is used here
28
29The verifier will reject such code with above error.
30At insn 18 the r7 is indeed unbounded. The later insn 19 checks the bounds and
31the insn 20 undoes map_value addition. It is currently impossible for the
32verifier to understand such speculative pointer arithmetic.
33Hence
34    https://reviews.llvm.org/D85570
35addresses it on the compiler side. It was committed on llvm 12.
36
37The corresponding C code
38.. code-block:: c
39
40  for (int i = 0; i < MAX_CGROUPS_PATH_DEPTH; i++) {
41          filepart_length = bpf_probe_read_str(payload, ...);
42          if (filepart_length <= MAX_PATH) {
43                  barrier_var(filepart_length); // workaround
44                  payload += filepart_length;
45          }
46  }
47
48bpf_iter test failures with clang/llvm 10.0.0
49=============================================
50
51With clang/llvm 10.0.0, the following two bpf_iter tests failed:
52  * ``bpf_iter/ipv6_route``
53  * ``bpf_iter/netlink``
54
55The symptom for ``bpf_iter/ipv6_route`` looks like
56
57.. code-block:: c
58
59  2: (79) r8 = *(u64 *)(r1 +8)
60  ...
61  14: (bf) r2 = r8
62  15: (0f) r2 += r1
63  ; BPF_SEQ_PRINTF(seq, "%pi6 %02x ", &rt->fib6_dst.addr, rt->fib6_dst.plen);
64  16: (7b) *(u64 *)(r8 +64) = r2
65  only read is supported
66
67The symptom for ``bpf_iter/netlink`` looks like
68
69.. code-block:: c
70
71  ; struct netlink_sock *nlk = ctx->sk;
72  2: (79) r7 = *(u64 *)(r1 +8)
73  ...
74  15: (bf) r2 = r7
75  16: (0f) r2 += r1
76  ; BPF_SEQ_PRINTF(seq, "%pK %-3d ", s, s->sk_protocol);
77  17: (7b) *(u64 *)(r7 +0) = r2
78  only read is supported
79
80This is due to a llvm BPF backend bug. The fix
81  https://reviews.llvm.org/D78466
82has been pushed to llvm 10.x release branch and will be
83available in 10.0.1. The fix is available in llvm 11.0.0 trunk.
84
85BPF CO-RE-based tests and Clang version
86=======================================
87
88A set of selftests use BPF target-specific built-ins, which might require
89bleeding-edge Clang versions (Clang 12 nightly at this time).
90
91Few sub-tests of core_reloc test suit (part of test_progs test runner) require
92the following built-ins, listed with corresponding Clang diffs introducing
93them to Clang/LLVM. These sub-tests are going to be skipped if Clang is too
94old to support them, they shouldn't cause build failures or runtime test
95failures:
96
97  - __builtin_btf_type_id() ([0], [1], [2]);
98  - __builtin_preserve_type_info(), __builtin_preserve_enum_value() ([3], [4]).
99
100  [0] https://reviews.llvm.org/D74572
101  [1] https://reviews.llvm.org/D74668
102  [2] https://reviews.llvm.org/D85174
103  [3] https://reviews.llvm.org/D83878
104  [4] https://reviews.llvm.org/D83242
105