Name Date Size #Lines LOC

..--

android/H25-Apr-2025-187119

arm64/H25-Apr-2025-295,098260,314

loongarch/H25-Apr-2025-236,816210,496

powerpc/H25-Apr-2025-258,598232,856

riscv/H25-Apr-2025-293,700257,336

x86/H25-Apr-2025-268,584237,444

.gitignoreH A D25-Apr-2025681 6665

Android.bpH A D25-Apr-202515 KiB716624

MakefileH A D25-Apr-20255.7 KiB246202

Makefile.btfgenH A D25-Apr-20251.3 KiB4128

README.mdH A D25-Apr-20255.6 KiB12297

bashreadline.bpf.cH A D25-Apr-2025910 3927

bashreadline.cH A D25-Apr-20255.3 KiB237190

bashreadline.hH A D25-Apr-2025256 148

bindsnoop.bpf.cH A D25-Apr-20254 KiB152124

bindsnoop.cH A D25-Apr-20257 KiB298257

bindsnoop.hH A D25-Apr-2025522 3226

biolatency.bpf.cH A D25-Apr-20254.2 KiB187141

biolatency.cH A D25-Apr-20259 KiB360316

biolatency.hH A D25-Apr-2025391 2315

biopattern.bpf.cH A D25-Apr-20251.5 KiB5848

biopattern.cH A D25-Apr-20255.7 KiB248212

biopattern.hH A D25-Apr-2025245 1510

biosnoop.bpf.cH A D25-Apr-20254.8 KiB205163

biosnoop.cH A D25-Apr-20258.8 KiB370318

biosnoop.hH A D25-Apr-2025465 2720

biostacks.bpf.cH A D25-Apr-20253 KiB134111

biostacks.cH A D25-Apr-20256.2 KiB248212

biostacks.hH A D25-Apr-2025505 2820

biotop.bpf.cH A D25-Apr-20253.1 KiB143108

biotop.cH A D25-Apr-20259.9 KiB471391

biotop.hH A D25-Apr-2025655 3926

bitesize.bpf.cH A D25-Apr-20251.9 KiB8665

bitesize.cH A D25-Apr-20255.3 KiB241204

bitesize.hH A D25-Apr-2025404 2315

bits.bpf.hH A D25-Apr-2025638 3223

blk_types.hH A D25-Apr-20254.1 KiB12773

btf_helpers.cH A D25-Apr-20254.8 KiB248196

btf_helpers.hH A D25-Apr-2025277 126

cachestat.bpf.cH A D25-Apr-20251.9 KiB9175

cachestat.cH A D25-Apr-20257.7 KiB282230

capable.bpf.cH A D25-Apr-20253.6 KiB163123

capable.cH A D25-Apr-202510.7 KiB416362

capable.hH A D25-Apr-2025463 3323

compat.bpf.hH A D25-Apr-20251 KiB4632

compat.cH A D25-Apr-20252.3 KiB11695

compat.hH A D25-Apr-20251.1 KiB4733

core_fixes.bpf.hH A D25-Apr-20257.6 KiB253133

cpudist.bpf.cH A D25-Apr-20252.8 KiB122102

cpudist.cH A D25-Apr-20256.9 KiB304262

cpudist.hH A D25-Apr-2025238 149

cpufreq.bpf.cH A D25-Apr-20251.9 KiB8668

cpufreq.cH A D25-Apr-20256.7 KiB292243

cpufreq.hH A D25-Apr-2025334 2014

drsnoop.bpf.cH A D25-Apr-20252.6 KiB11792

drsnoop.cH A D25-Apr-20256 KiB255217

drsnoop.hH A D25-Apr-2025268 1611

drsnoop_example.txtH A D25-Apr-20252.3 KiB7251

errno_helpers.cH A D25-Apr-20255.5 KiB233210

errno_helpers.hH A D25-Apr-2025186 84

execsnoop.bpf.cH A D25-Apr-20253.5 KiB149119

execsnoop.cH A D25-Apr-20258.5 KiB381329

execsnoop.hH A D25-Apr-2025646 2722

exitsnoop.bpf.cH A D25-Apr-20251.7 KiB6350

exitsnoop.cH A D25-Apr-20256 KiB264220

exitsnoop.hH A D25-Apr-2025304 1914

filelife.bpf.cH A D25-Apr-20253.5 KiB13487

filelife.cH A D25-Apr-20254.5 KiB191154

filelife.hH A D25-Apr-2025288 1611

filetop.bpf.cH A D25-Apr-20252.4 KiB9378

filetop.cH A D25-Apr-20257.4 KiB332287

filetop.hH A D25-Apr-2025465 3427

fsdist.bpf.cH A D25-Apr-20253.2 KiB194156

fsdist.cH A D25-Apr-202512.2 KiB450377

fsdist.hH A D25-Apr-2025269 2115

fsslower.bpf.cH A D25-Apr-20254.6 KiB209170

fsslower.cH A D25-Apr-202512.3 KiB464383

fsslower.hH A D25-Apr-2025417 2822

funclatency.bpf.cH A D25-Apr-20251.9 KiB10886

funclatency.cH A D25-Apr-202510.3 KiB438370

funclatency.hH A D25-Apr-2025155 128

gethostlatency.bpf.cH A D25-Apr-20251.7 KiB7658

gethostlatency.cH A D25-Apr-20257 KiB299249

gethostlatency.hH A D25-Apr-2025284 1611

hardirqs.bpf.cH A D25-Apr-20252.8 KiB131104

hardirqs.cH A D25-Apr-20256.6 KiB289245

hardirqs.hH A D25-Apr-2025243 1711

javagc.bpf.cH A D25-Apr-20251.6 KiB8266

javagc.cH A D25-Apr-20255.6 KiB244200

javagc.hH A D25-Apr-2025219 138

kernel.configH A D25-Apr-2025125.1 KiB4,8154,556

klockstat.bpf.cH A D25-Apr-202515.1 KiB743579

klockstat.cH A D25-Apr-202521.8 KiB789686

klockstat.hH A D25-Apr-2025499 2419

ksnoop.bpf.cH A D25-Apr-202512.6 KiB461313

ksnoop.cH A D25-Apr-202523.9 KiB1,009858

ksnoop.hH A D25-Apr-20252.9 KiB12489

llcstat.bpf.cH A D25-Apr-20251.2 KiB5946

llcstat.cH A D25-Apr-20256.3 KiB270232

llcstat.hH A D25-Apr-2025284 2014

map_helpers.cH A D25-Apr-20252.2 KiB10784

map_helpers.hH A D25-Apr-2025328 126

maps.bpf.hH A D25-Apr-20251.4 KiB4318

mdflush.bpf.cH A D25-Apr-20251.3 KiB4738

mdflush.cH A D25-Apr-20253.5 KiB163127

mdflush.hH A D25-Apr-2025302 1610

memleak.bpf.cH A D25-Apr-20259.4 KiB460357

memleak.cH A D25-Apr-202527.1 KiB1,069818

memleak.hH A D25-Apr-2025332 2217

mountsnoop.bpf.cH A D25-Apr-20253.1 KiB128105

mountsnoop.cH A D25-Apr-20257.4 KiB334284

mountsnoop.hH A D25-Apr-2025614 4134

numamove.bpf.cH A D25-Apr-20251.4 KiB7156

numamove.cH A D25-Apr-20253.3 KiB135109

offcputime.bpf.cH A D25-Apr-20252.8 KiB11396

offcputime.cH A D25-Apr-20259.8 KiB366326

offcputime.hH A D25-Apr-2025304 2014

oomkill.bpf.cH A D25-Apr-2025846 3022

oomkill.cH A D25-Apr-20254.1 KiB188152

oomkill.hH A D25-Apr-2025266 1611

opensnoop.bpf.cH A D25-Apr-20253.3 KiB137106

opensnoop.cH A D25-Apr-20259 KiB398339

opensnoop.hH A D25-Apr-2025439 2720

readahead.bpf.cH A D25-Apr-20251.8 KiB8868

readahead.cH A D25-Apr-20253.7 KiB165130

readahead.hH A D25-Apr-2025221 149

runqlat.bpf.cH A D25-Apr-20254 KiB178142

runqlat.cH A D25-Apr-20256.9 KiB291252

runqlat.hH A D25-Apr-2025241 149

runqlen.bpf.cH A D25-Apr-20251.2 KiB5336

runqlen.cH A D25-Apr-20257.1 KiB318272

runqlen.hH A D25-Apr-2025212 138

runqslower.bpf.cH A D25-Apr-20252.8 KiB11889

runqslower.cH A D25-Apr-20255.5 KiB227194

runqslower.hH A D25-Apr-2025283 1611

runqslower_example.txtH A D25-Apr-20251.9 KiB5540

sigsnoop.bpf.cH A D25-Apr-20253.2 KiB146115

sigsnoop.cH A D25-Apr-20256.1 KiB265224

sigsnoop.hH A D25-Apr-2025283 1711

sigsnoop_example.txtH A D25-Apr-20251.6 KiB4633

slabratetop.bpf.cH A D25-Apr-20251.3 KiB5440

slabratetop.cH A D25-Apr-20256.7 KiB307263

slabratetop.hH A D25-Apr-2025247 149

softirqs.bpf.cH A D25-Apr-20251.7 KiB8971

softirqs.cH A D25-Apr-20256.1 KiB281237

softirqs.hH A D25-Apr-2025192 127

solisten.bpf.cH A D25-Apr-20252.5 KiB10282

solisten.cH A D25-Apr-20255.1 KiB222181

solisten.hH A D25-Apr-2025278 1813

stat.hH A D25-Apr-2025767 2821

statsnoop.bpf.cH A D25-Apr-20253.2 KiB131104

statsnoop.cH A D25-Apr-20255.7 KiB227192

statsnoop.hH A D25-Apr-2025285 1712

syscall_helpers.cH A D25-Apr-202518.5 KiB852809

syscall_helpers.hH A D25-Apr-2025313 138

syscount.bpf.cH A D25-Apr-20252.8 KiB11689

syscount.cH A D25-Apr-202512 KiB511438

syscount.hH A D25-Apr-2025274 1710

tcpconnect.bpf.cH A D25-Apr-20255.3 KiB227182

tcpconnect.cH A D25-Apr-202510.4 KiB460401

tcpconnect.hH A D25-Apr-2025732 4735

tcpconnlat.bpf.cH A D25-Apr-20253.2 KiB141115

tcpconnlat.cH A D25-Apr-20256.5 KiB249212

tcpconnlat.hH A D25-Apr-2025392 2721

tcplife.bpf.cH A D25-Apr-20253.9 KiB153131

tcplife.cH A D25-Apr-20255.9 KiB248206

tcplife.hH A D25-Apr-2025455 2922

tcppktlat.bpf.cH A D25-Apr-20253.6 KiB143117

tcppktlat.cH A D25-Apr-20256.6 KiB268236

tcppktlat.hH A D25-Apr-2025321 2015

tcppktlat_example.txtH A D25-Apr-20253.3 KiB7154

tcprtt.bpf.cH A D25-Apr-20254.2 KiB157118

tcprtt.cH A D25-Apr-20258.8 KiB342298

tcprtt.hH A D25-Apr-2025293 2014

tcpstates.bpf.cH A D25-Apr-20252.7 KiB10382

tcpstates.cH A D25-Apr-20257.4 KiB297256

tcpstates.hH A D25-Apr-2025419 2418

tcpsynbl.bpf.cH A D25-Apr-20251.4 KiB6752

tcpsynbl.cH A D25-Apr-20255.7 KiB260217

tcpsynbl.hH A D25-Apr-2025192 127

tcptop.bpf.cH A D25-Apr-20253.2 KiB12892

tcptop.cH A D25-Apr-20259.5 KiB427356

tcptop.hH A D25-Apr-2025358 2317

tcptracer.bpf.cH A D25-Apr-20257.6 KiB336251

tcptracer.cH A D25-Apr-20256.9 KiB315270

tcptracer.hH A D25-Apr-2025733 4329

trace_helpers.cH A D25-Apr-202524.3 KiB1,2351,007

trace_helpers.hH A D25-Apr-20253.2 KiB10556

uprobe_helpers.cH A D25-Apr-20256.5 KiB295233

uprobe_helpers.hH A D25-Apr-2025649 1913

vfsstat.bpf.cH A D25-Apr-20251.3 KiB7961

vfsstat.cH A D25-Apr-20254.9 KiB215183

vfsstat.hH A D25-Apr-2025224 1611

wakeuptime.bpf.cH A D25-Apr-20252.2 KiB9876

wakeuptime.cH A D25-Apr-20257 KiB274239

wakeuptime.hH A D25-Apr-2025281 1610

README.md

1Useful links
2------------
3
4- [BPF Portability and CO-RE](https://facebookmicrosites.github.io/bpf/blog/2020/02/19/bpf-portability-and-co-re.html)
5- [HOWTO: BCC to libbpf conversion](https://facebookmicrosites.github.io/bpf/blog/2020/02/20/bcc-to-libbpf-howto-guide.html)
6- [Tips & tricks for writing libbpf-tools](https://en.pingcap.com/blog/tips-and-tricks-for-writing-linux-bpf-applications-with-libbpf)
7
8Building
9-------
10
11To build libbpf-based tools, simply run `make`. This will build all the listed
12tools/applications. All the build artifacts, by default, go into .output
13subdirectory to keep source code and build artifacts completely separate. The
14only exception is resulting tool binaries, which are put in a current
15directory. `make clean` will clean up all the build artifacts, including
16generated binaries.
17
18Given that the libbpf package might not be available across wide variety of
19distributions, all libbpf-based tools are linked statically against a version
20of libbpf that BCC links against (from submodule under src/cc/libbpf). This
21results in binaries with minimal amount of dependencies (libc, libelf, and
22libz are linked dynamically, though, given their widespread availability).
23If your build fails because the libbpf submodule is outdated, try running `git
24submodule update --init --recursive`.
25
26Tools are expected to follow a simple naming convention:
27  - <tool>.c contains userspace C code of a tool.
28  - <tool>.bpf.c contains BPF C code, which gets compiled into BPF ELF file.
29    This ELF file is used to generate BPF skeleton <tool>.skel.h, which is
30    subsequently is included from <tool>.c.
31  - <tool>.h can optionally contain any types and constants, shared by both
32    BPF and userspace sides of a tool.
33
34For such cases, simply adding <tool> name to Makefile's APPS variable will
35ensure this tool is built alongside others.
36
37For more complicated applications, some extra Makefile rules might need to be
38created. For such cases, it is advised to put application into a dedicated
39subdirectory and link it from main Makefile.
40
41vmlinux.h generation
42-------------------
43
44vmlinux.h contains all kernel types, both exported and internal-only. BPF
45CO-RE-based applications are expected to include this file in their BPF
46program C source code to avoid dependency on kernel headers package.
47
48For more reproducible builds, vmlinux.h header file is pre-generated and
49checked in along the other sources. This is done to avoid dependency on
50specific user/build server's kernel configuration, because vmlinux.h
51generation depends on having a kernel with BTF type information built-in
52(which is enabled by `CONFIG_DEBUG_INFO_BTF=y` Kconfig option See below).
53
54vmlinux.h is generated from upstream Linux version at particular minor
55version tag. E.g., `vmlinux_505.h` is generated from v5.5 tag. Exact set of
56types available in compiled kernel depends on configuration used to compile
57it. To generate present vmlinux.h header, default configuration was used, with
58only extra `CONFIG_DEBUG_INFO_BTF=y` option enabled.
59
60Given different kernel version can have incompatible type definitions, it
61might be important to use vmlinux.h of a specific kernel version as a "base"
62version of header. To that extent, all vmlinux.h headers are versioned by
63appending <MAJOR><MINOR> suffix to a file name. There is always a symbolic
64link vmlinux.h, that points to whichever version is deemed to be default
65(usually, latest).
66
67bpftool
68-------
69
70bpftool is a universal tool used for inspection of BPF resources, as well as
71providing various extra BPF-related facilities, like code-generation of BPF
72program skeletons. The latter functionality is heavily used by these tools to
73load and interact with BPF programs.
74
75Given bpftool package can't yet be expected to be available widely across many
76distributions, bpftool binary is checked in into BCC repository in bin/
77subdirectory. Once bpftool package is more widely available, this can be
78changed in favor of using pre-packaged version of bpftool.
79
80
81Re-compiling your Kernel with CONFIG_DEBUG_INFO_BTF=y
82-----------------------------------------------------
83libbpf probes to see if your sys fs exports the file `/sys/kernel/btf/vmlinux` (from Kernel 5.5+) or if you have the ELF version in your system [`code`](https://github.com/libbpf/libbpf/blob/master/src/btf.c)
84Please note the ELF file could exist without the BTF info in it. Your Kconfig should contain the options below
85
861. Compile options
87```code
88CONFIG_DEBUG_INFO_BTF=y
89CONFIG_DEBUG_INFO=y
90```
912. Also, make sure that you have pahole 1.13 (or preferably 1.16+) during the
92kernel build (it comes from dwarves package). Without it, BTF won't be
93generated, and on older kernels you'd get only warning, but still would
94build kernel successfully
95
96Running in kernels without CONFIG_DEBUG_INFO_BTF=y
97--------------------------------------------------
98
99It's possible to run some tools in kernels that don't expose
100`/sys/kernel/btf/vmlinux`. For those cases,
101[BTFGen](https://lore.kernel.org/bpf/[email protected])
102and [BTFHub](https://github.com/aquasecurity/btfhub) can be used to
103generate small BTF files for the most popular Linux distributions that
104are shipped with the tools in order to provide the needed information to
105perform the CO-RE relocations when loading the eBPF programs.
106
107If you haven't cloned the
108[btfhub-archive](https://github.com/aquasecurity/btfhub) repository, you
109can run make and it'll clone it for you into the `$HOME/.local/share`
110directory:
111
112```bash
113make ENABLE_MIN_CORE_BTFS=1 -j$(nproc)
114```
115
116If you have a local copy of such repository, you can pass it's location
117to avoid cloning it again:
118
119```bash
120make ENABLE_MIN_CORE_BTFS=1 BTF_HUB_ARCHIVE=<path_to_btfhub-archive> -j$(nproc)
121```
122