Maintenance: update libbpf to 1.7.0, fix CI, add Docker build/test#13
Merged
Conversation
Provide a reproducible container for building and running the example so it no longer depends on a specific host setup. Verified to build and pass the test end-to-end under Docker Desktop on both x86_64 and aarch64. Two fixes were needed to make this work portably: - src/Makefile: point clang's bpf target at the host multiarch include dir ($(uname -m)-linux-gnu) so headers like <asm/types.h> are found. Previously this relied on gcc-multilib, which is x86-only and unavailable on arm64. - test/test.sh: invoke the loader directly instead of via sudo. The script already re-execs as root, so the extra sudo only broke root environments without sudo installed, such as containers. Usage: docker build -t ebpf-kill-example . docker run --rm --privileged ebpf-kill-example The entrypoint mounts tracefs (requires --privileged) so the kill tracepoint is reachable at test time.
The ubuntu-20.04 runner was retired by GitHub (April 2025) so CI no longer runs, and actions/checkout@v2 relies on a deprecated Node runtime. Move to ubuntu-24.04 (GA; 26.04 is still preview) and actions/checkout@v4.
Bump the vendored libbpf from v1.2.0 to v1.7.0 (latest stable, Mar 2025). The loader and eBPF program build unchanged against the new API, and the test passes end-to-end (verified in Docker). Also add zlib1g-dev to 'make deps', which newer libbpf requires at build time.
Replace the legacy 'clang -emit-llvm | llc' two-step with a single 'clang -target bpf ... -c -o kern.o' invocation. This is the standard modern way to build BPF objects, avoids llc version-skew issues, and removes the intermediate kern.ll artifact. Verified building and passing tests in Docker.
Replace sprintf with snprintf bounded by sizeof(path) so an unusually long argv[0] cannot overflow the PATH_MAX buffer.
Add a Docker section covering the reproducible build/test environment, note it as the easiest path on non-Linux hosts and on arm64 (where gcc-multilib is unavailable), and list zlib1g-dev among the dependencies.
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.
Housekeeping pass to get the project building and testing again.
ubuntu-20.04runner →ubuntu-24.04,checkout@v2→v4docker run --rm --privileged ebpf-kill-examplebuilds and runs the test with no local toolchainclangstep (drops the legacyllctwo-step) and finds headers portably across architecturessprintf→snprintfVerified building and passing
make testend-to-end in Docker.