Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
Makefile | D | 08-May-2024 | 5.5 KiB | 162 | 137 | |
README.rst | D | 08-May-2024 | 1.9 KiB | 67 | 45 | |
bpf_helpers.h | D | 08-May-2024 | 5.8 KiB | 156 | 128 | |
bpf_load.c | D | 08-May-2024 | 9.6 KiB | 441 | 356 | |
bpf_load.h | D | 08-May-2024 | 858 | 34 | 16 | |
fds_example.c | D | 08-May-2024 | 4 KiB | 184 | 155 | |
lathist_kern.c | D | 08-May-2024 | 2.1 KiB | 100 | 68 | |
lathist_user.c | D | 08-May-2024 | 2 KiB | 104 | 75 | |
libbpf.c | D | 08-May-2024 | 3.9 KiB | 179 | 144 | |
libbpf.h | D | 08-May-2024 | 5.6 KiB | 214 | 156 | |
map_perf_test_kern.c | D | 08-May-2024 | 2.5 KiB | 101 | 82 | |
map_perf_test_user.c | D | 08-May-2024 | 3.2 KiB | 157 | 121 | |
offwaketime_kern.c | D | 08-May-2024 | 3.5 KiB | 152 | 118 | |
offwaketime_user.c | D | 08-May-2024 | 2.4 KiB | 121 | 96 | |
parse_ldabs.c | D | 08-May-2024 | 1.2 KiB | 43 | 32 | |
parse_simple.c | D | 08-May-2024 | 1.3 KiB | 50 | 36 | |
parse_varlen.c | D | 08-May-2024 | 3.5 KiB | 155 | 125 | |
sampleip_kern.c | D | 08-May-2024 | 924 | 39 | 26 | |
sampleip_user.c | D | 08-May-2024 | 4.2 KiB | 197 | 152 | |
sock_example.c | D | 08-May-2024 | 2.7 KiB | 102 | 70 | |
sockex1_kern.c | D | 08-May-2024 | 648 | 30 | 24 | |
sockex1_user.c | D | 08-May-2024 | 979 | 50 | 37 | |
sockex2_kern.c | D | 08-May-2024 | 4.7 KiB | 222 | 188 | |
sockex2_user.c | D | 08-May-2024 | 1 KiB | 53 | 43 | |
sockex3_kern.c | D | 08-May-2024 | 6.1 KiB | 291 | 226 | |
sockex3_user.c | D | 08-May-2024 | 1.4 KiB | 70 | 59 | |
spintest_kern.c | D | 08-May-2024 | 2.1 KiB | 69 | 55 | |
spintest_user.c | D | 08-May-2024 | 1 KiB | 51 | 44 | |
tc_l2_redirect.sh | D | 08-May-2024 | 4.9 KiB | 174 | 135 | |
tc_l2_redirect_kern.c | D | 08-May-2024 | 6 KiB | 237 | 181 | |
tc_l2_redirect_user.c | D | 08-May-2024 | 1.5 KiB | 74 | 56 | |
tcbpf1_kern.c | D | 08-May-2024 | 2.5 KiB | 91 | 75 | |
tcbpf2_kern.c | D | 08-May-2024 | 8.1 KiB | 383 | 311 | |
test_cgrp2_array_pin.c | D | 08-May-2024 | 2.2 KiB | 110 | 91 | |
test_cgrp2_attach.c | D | 08-May-2024 | 4.1 KiB | 148 | 101 | |
test_cgrp2_tc.sh | D | 08-May-2024 | 4.1 KiB | 185 | 158 | |
test_cgrp2_tc_kern.c | D | 08-May-2024 | 1.8 KiB | 71 | 55 | |
test_cls_bpf.sh | D | 08-May-2024 | 880 | 38 | 31 | |
test_current_task_under_cgroup_kern.c | D | 08-May-2024 | 1.1 KiB | 44 | 29 | |
test_current_task_under_cgroup_user.c | D | 08-May-2024 | 3.2 KiB | 146 | 103 | |
test_ipip.sh | D | 08-May-2024 | 5.6 KiB | 179 | 147 | |
test_maps.c | D | 08-May-2024 | 13.3 KiB | 504 | 340 | |
test_overhead_kprobe_kern.c | D | 08-May-2024 | 1 KiB | 42 | 29 | |
test_overhead_tp_kern.c | D | 08-May-2024 | 828 | 37 | 26 | |
test_overhead_user.c | D | 08-May-2024 | 3.2 KiB | 163 | 135 | |
test_probe_write_user_kern.c | D | 08-May-2024 | 1.6 KiB | 53 | 32 | |
test_probe_write_user_user.c | D | 08-May-2024 | 2.4 KiB | 79 | 60 | |
test_tunnel_bpf.sh | D | 08-May-2024 | 4.2 KiB | 168 | 129 | |
test_verifier.c | D | 08-May-2024 | 74.2 KiB | 2,536 | 2,479 | |
trace_event_kern.c | D | 08-May-2024 | 1.7 KiB | 66 | 50 | |
trace_event_user.c | D | 08-May-2024 | 4.6 KiB | 214 | 175 | |
trace_output_kern.c | D | 08-May-2024 | 609 | 31 | 24 | |
trace_output_user.c | D | 08-May-2024 | 4 KiB | 197 | 154 | |
tracex1_kern.c | D | 08-May-2024 | 1.4 KiB | 49 | 25 | |
tracex1_user.c | D | 08-May-2024 | 403 | 26 | 19 | |
tracex2_kern.c | D | 08-May-2024 | 2.3 KiB | 101 | 76 | |
tracex2_user.c | D | 08-May-2024 | 3 KiB | 150 | 124 | |
tracex3_kern.c | D | 08-May-2024 | 2.1 KiB | 90 | 58 | |
tracex3_user.c | D | 08-May-2024 | 3.1 KiB | 158 | 131 | |
tracex4_kern.c | D | 08-May-2024 | 1.2 KiB | 55 | 36 | |
tracex4_user.c | D | 08-May-2024 | 1.4 KiB | 70 | 51 | |
tracex5_kern.c | D | 08-May-2024 | 1.9 KiB | 74 | 53 | |
tracex5_user.c | D | 08-May-2024 | 1.1 KiB | 50 | 38 | |
tracex6_kern.c | D | 08-May-2024 | 611 | 28 | 22 | |
tracex6_user.c | D | 08-May-2024 | 1.4 KiB | 73 | 60 | |
xdp1_kern.c | D | 08-May-2024 | 2.1 KiB | 94 | 72 | |
xdp1_user.c | D | 08-May-2024 | 3.9 KiB | 182 | 144 | |
xdp2_kern.c | D | 08-May-2024 | 2.4 KiB | 115 | 90 |
README.rst
1eBPF sample programs 2==================== 3 4This directory contains a mini eBPF library, test stubs, verifier 5test-suite and examples for using eBPF. 6 7Build dependencies 8================== 9 10Compiling requires having installed: 11 * clang >= version 3.4.0 12 * llvm >= version 3.7.1 13 14Note that LLVM's tool 'llc' must support target 'bpf', list version 15and supported targets with command: ``llc --version`` 16 17Kernel headers 18-------------- 19 20There are usually dependencies to header files of the current kernel. 21To avoid installing devel kernel headers system wide, as a normal 22user, simply call:: 23 24 make headers_install 25 26This will creates a local "usr/include" directory in the git/build top 27level directory, that the make system automatically pickup first. 28 29Compiling 30========= 31 32For building the BPF samples, issue the below command from the kernel 33top level directory:: 34 35 make samples/bpf/ 36 37Do notice the "/" slash after the directory name. 38 39It is also possible to call make from this directory. This will just 40hide the the invocation of make as above with the appended "/". 41 42Manually compiling LLVM with 'bpf' support 43------------------------------------------ 44 45Since version 3.7.0, LLVM adds a proper LLVM backend target for the 46BPF bytecode architecture. 47 48By default llvm will build all non-experimental backends including bpf. 49To generate a smaller llc binary one can use:: 50 51 -DLLVM_TARGETS_TO_BUILD="BPF" 52 53Quick sniplet for manually compiling LLVM and clang 54(build dependencies are cmake and gcc-c++):: 55 56 $ git clone http://llvm.org/git/llvm.git 57 $ cd llvm/tools 58 $ git clone --depth 1 http://llvm.org/git/clang.git 59 $ cd ..; mkdir build; cd build 60 $ cmake .. -DLLVM_TARGETS_TO_BUILD="BPF;X86" 61 $ make -j $(getconf _NPROCESSORS_ONLN) 62 63It is also possible to point make to the newly compiled 'llc' or 64'clang' command via redefining LLC or CLANG on the make command line:: 65 66 make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang 67