Repository navigation
[16.0-stable] Make bpftrace-aotrt usable again - #7057
Merged
Merged
Conversation
16.0 is the only release on bpftrace 0.23.3: every other branch runs 0.20.3, and master went back to it in lf-edge#5803. Its debug container's /usr/bin/bpftrace-aotrt does not start: TestVGAPassthroughNoHostAccess fails with "Process exited with status 127", and run by hand on the device the runtime reports libbfd-2.44.so and libopcodes-2.44.so as not found. 0.23.3 links binutils' libraries and libpcap into the runtime, and the Dockerfile copies only the libraries 0.20.3 needed next to it. With the libraries in place the runtime still cannot serve EVE: between 0.20.3 and 0.23.3, bpftrace --aot stopped producing a payload file and instead injects the payload into a copy of the bpftrace-aotrt shim as an ELF section, which the shim then loads from its own executable, taking no file argument and refusing to run under its own name. bpftrace-compiler uploads the raw payload (temp_btaot, kept by patch 0001) and runs "bpftrace-aotrt -f json /tmp/bpf.aot", on this release as on all others. A third difference bites once the program runs: 0.23.3 compiles helper error checks into the program by default (0.20.3 did not, and refused -k together with --aot), but the helper error information is not part of the AOT payload. The runtime formats the first failed helper, here delete() of a key that was never inserted, with a null helper name, which puts its JSON output stream into the failed state: nothing is printed after that line, and the test fails on the broken line. Ship the missing libraries with the runtime and add two patches: 0003 gives bpftrace-aotrt its file argument back, reads the file as the raw payload and parses the kernel BTF before running the program, as the bpftrace binary does and run() expects; 0004 compiles ahead-of-time programs without helper error checks, as 0.20.3 did. The debug container and the installer move to the rebuilt packages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
The tracer root image still pinned the eve-bpftrace built from 0.20.3 (c08d714) while the debug container on this branch runs 0.23.3. Both sides check the bpftrace version through the hash in the AOT header, so a script compiled in the VM is rejected by the device's runtime as a build hash mismatch. Pin the package the debug container ships, build the image on the same eve-alpine, and install the libraries its bpftrace binary loads (LLVM and clang 20, binutils, libpcap), which copy-out.sh collects through ldd. Compiled scripts are cached by the content of root/, so results of the old image are not reused. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 16.0-stable #7057 +/- ##
===============================================
+ Coverage 31.67% 33.55% +1.88%
===============================================
Files 10 15 +5
Lines 1026 2962 +1936
===============================================
+ Hits 325 994 +669
- Misses 701 1968 +1267 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
check if stdout is already closed, if so do nothing Signed-off-by: Christoph Ostarek <christoph@zededa.com> (cherry picked from commit e71a6f4)
TestVGAPassthroughNoHostAccess failed in every nightly run with "Host processes interfered with PCI devices ...: [app-restart] pci_user_write_config_word comm=CPU 0/KVM pid=<qemu>". The tracer's comm is the name of the calling thread, and QEMU names its vCPU threads "CPU <n>/KVM". The guest's own config-space writes to the passed-through device reach the kernel from those threads, but isViolation allowed only threads named "qemu-system-*", so every write of the guest was reported as host interference. Allow QEMU's vCPU threads too. Only a qemu holding the device's VFIO file can write its config space this way, so no access by another process is let through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com> (cherry picked from commit 26581c7)
The bpftrace-compiler tests boot QEMU for amd64 and arm64 and take roughly 53 minutes, over half of the Go Tests workflow. Running them in the middle of the test target also means a failure there skips every remaining suite along with the coverage upload. They now live in test-bpftrace, reached from test-all, with their own workflow triggered only by changes to pkg/bpftrace, eve-tools/bpftrace-compiler or kernel-commits.mk -- the three inputs they can regress from. Building the arm64 eve-bpftrace package was also the only reason these jobs touched a second architecture. linuxkit matches a FROM against its local cache by name alone, so an entry populated for one architecture hides the registry's multi-arch manifest from the other, and a package published while the job runs can leave it building against an image it cannot resolve. make test now stays on the host architecture throughout, and test-bpftrace passes --pull so an already-published architecture is fetched into the cache rather than skipped. Signed-off-by: eriknordmark <erik@zededa.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 2c33bb1)
christoph-zededa
force-pushed
the
16.0-fix-bpftrace
branch
from
November 9, 2026 11:05
c078ab7 to
3c70755
Compare
christoph-zededa
marked this pull request as ready for review
November 9, 2026 12:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
16.0-stable is the only branch on bpftrace 0.23.3. The alpine 3.22 series
(#5650, backported in #6707) carried the bump from 0.20.3 to 0.23.3, and the
follow-up #5803, which took master back to 0.20.3, was not backported because
16.0 was still on the old alpine at the time; 17.0, 14.5 and 13.4 run 0.20.3.
Since #6707 the AOT runtime in the debug container has not worked on this
branch:
TestVGAPassthroughNoHostAccessfails with "Process exited withstatus 127".
Four problems, each hidden behind the previous one:
/usr/bin/bpftrace-aotrtdoes not start. 0.23.3 links libbfd, libopcodesand libpcap into the runtime, and pkg/bpftrace copies only the libraries
0.20.3 needed next to it. Run by hand on the device: "Error relocating
/usr/bin/bpftrace-aotrt: bfd_get_arch: symbol not found", exit 127.
alpine 3.22: fix bpftrace #5803 names as the reason to go back:
bpftrace --aotinjects the payloadinto a copy of the shim as an ELF section, and the shim loads it from its
own executable, takes no file argument and refuses to run under its own
name. EVE uploads the raw payload (temp_btaot, kept by patch 0001) and runs
bpftrace-aotrt -f json /tmp/bpf.aot, on this release as on all others.helper error table is not part of the AOT payload (it is left out of
RequiredResources::serialize). The first failed helper, heredelete()of a key that was never inserted, is printed with a null helper name, which
puts the runtime's JSON output stream into the failed state: nothing is
printed after that line, and the test fails on the broken line.
built from 0.20.3 (c08d714d), whose output the 0.23.3 runtime rejects by
the version hash in the AOT header.
The fix stays on 0.23.3 and leaves the branch's package set alone:
patches: 0003 gives bpftrace-aotrt its file argument back, reads the file as
the raw payload and parses the kernel BTF before running the program (the
bpftrace binary does, and
run()dereferences it for every program); 0004compiles ahead-of-time programs without helper error checks, as 0.20.3 did,
which refused
-ktogether with--aot. pkg/debug and pkg/installer moveto the rebuilt package.
and installs the LLVM 20, clang 20, binutils and libpcap libraries its
bpftrace binary loads, which copy-out.sh collects through ldd.
panicked on exit after a failed run, which turned the real error into a Go
stack trace) and 26581c7 from evetest: fix recurring test and harness failures #7024 (qemu's vCPU threads write the
passed-through device's config space on the guest's behalf; the test needs
this on master as well).
make test"). On this branch
make teststill ran the bpftrace-compilertests inline, without building the checked-out pkg/bpftrace first, so the
Go Tests job of this PR failed in TestCompileAmd64 with
docker.io/lfedge/eve-bpftrace:7c4d9eff…: not found: the runner's cacheis empty and a PR's package is not on Docker Hub. Master runs these tests
from
make test-bpftrace, which first builds pkg/bpftrace for amd64 andarm64 from the checked-out tree, with
--pullso an architecture that isalready published is fetched into the cache instead of rebuilt, and
triggers them from their own workflow on changes to pkg/bpftrace,
eve-tools/bpftrace-compiler and kernel-commits.mk. The earlier master half
of that, 72501a6 prebuilding the package in the Go Tests workflow, came
with alpine 3.22: fix bpftrace #5803 and so never reached 16.0 either. Adapted for this branch: the
testtarget keepsmake -C pkg/dnsmasq testwhere master haspkg/alpine/dnstest; the go-tests.yml and publish.yml hunks are empty here,
16.0 never had the prebuild lines they remove; the CLAUDE.md hunk is
dropped, the file does not exist on 16.0; the new bpftrace-tests.yml is
master's current version, so it also carries the GIT_ASKPASS env block that
build: authenticate github.com git fetches in CI #6682 added later and whose 16.0 backport [16.0-stable] build: authenticate github.com git fetches in CI #6972 could not add to a file
that did not exist yet.
The alternative is to backport #5803 and return to 0.20.3. That needs llvm17
and clang17 in the 16.0 eve-alpine mirror and therefore rebuilds and
republishes every package of the branch. This PR is the minimal fix; its cost
is that 16.0 devices need a bpftrace-compiler built from this branch, as the
AOT payload is specific to the bpftrace version, while the revert would let
master's compiler serve 16.0 devices too.
PR dependencies
None. Cherry-picked with
-xfrom master:e71a6f4 (#5803),
26581c7 (#7024) and
2c33bb1 (#6329, with the adaptations listed
above).
How to test and validate this PR
make pkgs eve && EVETEST_PAUSE_ON_FAILURE=true make evetest NAME=TestVGAPassthroughNoHostAccesspasses (583 s on 2026-11-06, amd64, KVM): the tracer compiles in the VM
image, bpftrace-aotrt attaches its 11 probes on the device, the recorded
accesses are parsed, and no host process touched the passed-through
controller. Before this PR the same run fails at the end of phase 9 with
"Process exited with status 127".
eve exec debug /usr/bin/bpftrace-aotrt --helpprints theusage with a PROGRAM argument instead of "Error relocating
/usr/bin/bpftrace-aotrt: bfd_get_arch: symbol not found", and
bpftrace-compiler run-via-ssh <device>:22 examples/opensnoop.bt(builtfrom this branch) prints opens.
make test-bpftracefrom the repository root builds pkg/bpftrace for amd64and arm64 and runs the bpftrace-compiler tests against them; CI runs the
same from the new BPFTrace Tests workflow, and Go Tests no longer runs
these tests. Locally the arm64 package build needs binfmt, and
TestCompileArm64 needs qemu-system-aarch64; without it the test is skipped,
as on the CI runners.
its VM image inside the evetest container, whose buildkit pulls
lfedge/eve-bpftrace:<tag>from Docker Hub, so a locally built package hasto be copied from
~/.linuxkit/cacheinto~/.evetest/linuxkit-cachefirst (skopeo copy between the two OCI layouts). Not needed once the
publish run has pushed the package.
Changelog notes
bpftrace scripts compiled with bpftrace-compiler run again on 16.0 devices:
the debug container's bpftrace-aotrt starts and accepts the compiled script.
PR Backports
cherry-picked commits. Its
make teststill runs the bpftrace-compilertests inline, as on 14.5-stable and 13.4-stable, so the backport of Makefile: split bpftrace tests out of make test #6329
would apply there as well; not part of this PR.
Checklist
described in the patch headers and commit messages, nothing user-facing
changes.
library names are the same on aarch64 (libbfd-2.44.so, libopcodes-2.44.so)
and the patches are architecture-independent.
stablelabel, thisis not a backport.
And the last but not least:
check them.
🤖 Generated with Claude Code