Skip to content

Commit d441caf

Browse files
deps: bump github.com/cilium/ebpf from 0.21.0 to 0.22.0 (#2493)
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.21.0 to 0.22.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/cilium/ebpf/releases">github.com/cilium/ebpf's releases</a>.</em></p> <blockquote> <h2>v0.22.0: Linux 7.1 compat, BPF tokens and vmlinux BTF caching changes</h2> <p>Hi everyone! Today we announce the v0.22.0 release of ebpf-go. We ship Linux 7.1 compatibility, older versions of the library will not work on 7.1 kernels and above, so please upgrade if you are targeting the latest releases of Linux. We also made a breaking change to BTF caching, please read those notes. And of course a few fixes, improvements and minor features.</p> <h2>Kernel 7.1 compatibility</h2> <p>In kernel 7.1 the BTF header was extended to introduce a new feature called BTF layout. This change caused our BTF parser to fail when parsing vmlinux for this kernel. This has been fixed in this latest release, we recommend upgrading to this latest release to avoid breakage on 7.1 and newer kernels.</p> <p>See <a href="https://redirect.github.com/cilium/ebpf/pull/2042">cilium/ebpf#2042</a> for details. Special thanks to <a href="https://github.com/Capricornus007"><code>@​Capricornus007</code></a> for making the bug report that allowed us to fix this in a timely manner.</p> <h2>BPF token support</h2> <p>Some BPF-related actions require the user to have root privileges (<code>CAP_SYS_ADMIN</code>). One example is loading and attaching programs that can inspect kernel memory. In some environments, you may want to permit a known good process to load such BPF programs, but you don't want to grant it <code>CAP_SYS_ADMIN</code> to avoid privilege escalation if that process gets compromised.</p> <p><a href="https://docs.ebpf.io/linux/concepts/token/">BPF tokens</a> are a mechanism that allows a privileged process to delegate fine-grained BPF capabilities to an unprivileged process. The process of delegating is complex and typically handled by a container runtime such as <a href="https://linuxcontainers.org/incus/docs/main/explanation/bpf-tokens/">LXC</a> or a process manager like <a href="https://redirect.github.com/systemd/systemd/pull/36134">systemd</a>. This part of the handshake is currently out of scope of ebpf-go, as the library is not in charge of process creation where this delegation takes place.</p> <p>However, the consuming side is what's included in this release. ebpf-go will automatically detect when the current process is running in a namespace where a BPF token is provided, and will automatically try to obtain an use it for interacting with the BPF syscall. Unlike libbpf, this currently requires no extra configuration on behalf of the application.</p> <p>See <a href="https://redirect.github.com/cilium/ebpf/pull/1953">cilium/ebpf#1953</a> for more details.</p> <h2>BTF cache changes</h2> <p>Package <code>btf</code> used to cache kernel (vmlinux) BTF specs globally. This is a significant time gain when loading multiple Collections in a row. However, doing so comes at a fairly significant memory cost (~20 MiB), so users could flush this cache with <a href="https://pkg.go.dev/github.com/cilium/ebpf@v0.21.0/btf#FlushKernelSpec"><code>btf.FlushKernelSpec</code></a>. Unfortunately, the caching behaviour being opt-out means users would typically discover it while investigating memory usage, and would then have to find an appropriate time during execution to call the flush function. This was always a band-aid for something we didn't have a clear solution to.</p> <p>With this update, we've removed the global cache and the <a href="https://pkg.go.dev/github.com/cilium/ebpf@v0.21.0/btf#FlushKernelSpec"><code>btf.FlushKernelSpec</code></a> function, which may slow down subsequent collection loading on busy systems. To opt back in, users can now maintain their own cache object, obtained from <a href="https://pkg.go.dev/github.com/cilium/ebpf@v0.22.0/btf#NewCache"><code>btf.NewCache</code></a> and pass it to <a href="https://pkg.go.dev/github.com/cilium/ebpf@v0.22.0#NewCollectionWithOptions"><code>NewCollectionWithOptions</code></a> via <a href="https://pkg.go.dev/github.com/cilium/ebpf@v0.22.0#CollectionOptions"><code>CollectionOptions.Cache</code></a>. Typically, you would put this in a global variable in a bpf-related package in your application, or keep it around in function scope if you load multiple collections in a row.</p> <p>See <a href="https://redirect.github.com/cilium/ebpf/pull/1988">cilium/ebpf#1988</a> for more details. Thank you <a href="https://github.com/matthyx"><code>@​matthyx</code></a> for these changes.</p> <h2>New features</h2> <ul> <li>btf: print member names of btf.Unions and Structs by <a href="https://github.com/ti-mo"><code>@​ti-mo</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1967">cilium/ebpf#1967</a></li> <li>bpf2go: Generate constant names for maps, programs, and variables by <a href="https://github.com/mattijons"><code>@​mattijons</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1860">cilium/ebpf#1860</a></li> <li>Allow link.OpenExecutable for files without executable bit set by <a href="https://github.com/ti-mo"><code>@​ti-mo</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1982">cilium/ebpf#1982</a></li> <li>asm: add support for the may_goto insn and JCOND opcode by <a href="https://github.com/mtardy"><code>@​mtardy</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1898">cilium/ebpf#1898</a></li> </ul> <h2>Bug fixes and improvements</h2> <ul> <li>bpf2go: Improve error message when a C type cannot be resolved by <a href="https://github.com/awandke"><code>@​awandke</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1965">cilium/ebpf#1965</a></li> <li>btf: reject nil values or interfaces from being added to Builder by <a href="https://github.com/ti-mo"><code>@​ti-mo</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1966">cilium/ebpf#1966</a></li> <li>Use os.Getpagesize in tests instead of hardcoded 4k by <a href="https://github.com/shaunduncan"><code>@​shaunduncan</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1970">cilium/ebpf#1970</a></li> <li>map: avoid misleading error message for storage maps by <a href="https://github.com/venk8"><code>@​venk8</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1978">cilium/ebpf#1978</a></li> <li>struct_ops: Refactor struct_ops member population helpers by <a href="https://github.com/shun159"><code>@​shun159</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1986">cilium/ebpf#1986</a></li> <li>prog: restore btf.ErrNotFound behaviour of findTargetInKernel by <a href="https://github.com/ti-mo"><code>@​ti-mo</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1991">cilium/ebpf#1991</a></li> <li>asm: fix wrong bpf call offset display for jited programs by <a href="https://github.com/wucm667"><code>@​wucm667</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1996">cilium/ebpf#1996</a></li> <li>internal/kconfig: reject bool arrays for string values by <a href="https://github.com/immanuwell"><code>@​immanuwell</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/2006">cilium/ebpf#2006</a></li> <li>bpf2go: improve duplicate type name error message by <a href="https://github.com/wucm667"><code>@​wucm667</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1993">cilium/ebpf#1993</a></li> <li>doc: clarify Address vs Offset on Uprobe/Uretprobe by <a href="https://github.com/Strykar"><code>@​Strykar</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/2008">cilium/ebpf#2008</a></li> <li>fix(link): add missing BPF_F_REPLACE flag for RawAttachProgram by <a href="https://github.com/wucm667"><code>@​wucm667</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/1995">cilium/ebpf#1995</a></li> <li>tracefs: discover mount via /proc/self/mountinfo by <a href="https://github.com/yoav-orca"><code>@​yoav-orca</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/2004">cilium/ebpf#2004</a></li> <li>prog.go: cache BTF for CAP_SYS_ADMIN-less freplace by <a href="https://github.com/mejedi"><code>@​mejedi</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/2011">cilium/ebpf#2011</a></li> <li>BTF: fixed panics during parsing of malformed input by <a href="https://github.com/dylandreimerink"><code>@​dylandreimerink</code></a> in <a href="https://redirect.github.com/cilium/ebpf/pull/2021">cilium/ebpf#2021</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/cilium/ebpf/commit/e55144e17360b60cc4583229c35c2dbf0935b308"><code>e55144e</code></a> btf: Add BTF layout header parsing</li> <li><a href="https://github.com/cilium/ebpf/commit/d37ad9c7ca6e67ca4151800c8d81850f14f989d8"><code>d37ad9c</code></a> struct_ops_test: Fix <code>TestCreateStructOpsMapSpecSimple</code></li> <li><a href="https://github.com/cilium/ebpf/commit/5e8bcc7b5fd4f508e2e0b4fa27deb2ba9e3794ca"><code>5e8bcc7</code></a> btf: Remove vmlinux dedup test</li> <li><a href="https://github.com/cilium/ebpf/commit/f1eb026fa3e39a68c4ba7b42b29751f509e092c2"><code>f1eb026</code></a> Update kernel dependencies to 7.1</li> <li><a href="https://github.com/cilium/ebpf/commit/970a97d4cdf6755a563189385e8ead590aa67f94"><code>970a97d</code></a> CODEOWNERS: allow reviewers to merge docs/, add rgo3 to link/</li> <li><a href="https://github.com/cilium/ebpf/commit/7be98ef83bb9812d474bc7b448bb64b72e3283f7"><code>7be98ef</code></a> variable: reject offsets that overflow uint32 bounds</li> <li><a href="https://github.com/cilium/ebpf/commit/b404658b94df8f784d4a2df26210d12fae06c377"><code>b404658</code></a> build(deps): bump golangci/golangci-lint-action from 9.2.0 to 9.2.1</li> <li><a href="https://github.com/cilium/ebpf/commit/63647bcd9aacdc967007204cf9d42822db815071"><code>63647bc</code></a> build(deps): bump mkdocs-git-revision-date-localized-plugin</li> <li><a href="https://github.com/cilium/ebpf/commit/e30ccb7bbbc3dfa7376773ab08f977fba4710e99"><code>e30ccb7</code></a> memory: use unsafe.Add to align unsafe memory instead of uintptr conversion</li> <li><a href="https://github.com/cilium/ebpf/commit/0e35955f9c5a611322d33cce83103f04e2d008e3"><code>0e35955</code></a> Makefile: pre-create GOCACHE, GOPATH and GOMODCACHE for podman</li> <li>Additional commits viewable in <a href="https://github.com/cilium/ebpf/compare/v0.21.0...v0.22.0">compare view</a></li> </ul> </details> <br /> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 03e4284 commit d441caf

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ require (
221221
github.com/aws/aws-sdk-go-v2/service/s3 v1.107.1
222222
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5
223223
github.com/cilium/cilium v1.19.4
224-
github.com/cilium/ebpf v0.21.0
224+
github.com/cilium/ebpf v0.22.0
225225
github.com/cilium/hive v0.0.0-20260108104938-97756f6ff54c
226226
github.com/cilium/proxy v0.0.0-20250623105955-2136f59a4ea1
227227
github.com/cilium/workerpool v1.4.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ github.com/cilium/dns v1.1.51-0.20240603182237-af788769786a/go.mod h1:/7LC2GOgyX
270270
github.com/cilium/ebpf v0.5.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
271271
github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA=
272272
github.com/cilium/ebpf v0.8.1/go.mod h1:f5zLIM0FSNuAkSyLAN7X+Hy6yznlF1mNiWUMfxMtrgk=
273-
github.com/cilium/ebpf v0.21.0 h1:4dpx1J/B/1apeTmWBH5BkVLayHTkFrMovVPnHEk+l3k=
274-
github.com/cilium/ebpf v0.21.0/go.mod h1:1kHKv6Kvh5a6TePP5vvvoMa1bclRyzUXELSs272fmIQ=
273+
github.com/cilium/ebpf v0.22.0 h1:v2ktp0roffpMOj2MMf3idtCQZOsAoC4BJbAJN+ke2bY=
274+
github.com/cilium/ebpf v0.22.0/go.mod h1:CDzZbe2hC5JjlDC+CY3KFCzlYwN4gbxppYM+Z10bQt4=
275275
github.com/cilium/fake v0.7.0 h1:4EKBtTweQrJoD4q45qDGu8udulmYMo48Y0BhEbrB1jc=
276276
github.com/cilium/fake v0.7.0/go.mod h1:hA1YsEjgIs5Gdeq/DVrDWGuhLCoVok7THTvQaGDO5bc=
277277
github.com/cilium/hive v0.0.0-20260108104938-97756f6ff54c h1:mP/Z+oVplgbg3oV1lwsAC86NPLWioN/TqlmZ6+BI2I0=

0 commit comments

Comments
 (0)