feat : add BPF token support#1515
Open
MaximeWewer wants to merge 8 commits intoaya-rs:mainfrom
Open
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
tamird
reviewed
Apr 2, 2026
Comment on lines
+19
to
+20
| aya = { path = "../aya", version = "0.13" } | ||
| aya-obj = { path = "../aya-obj", version = "0.2" } |
Member
There was a problem hiding this comment.
This breaks the build because xtask depends on aya-tool (perhaps it shouldn't) and xtask needs to run on macOS -- aya does not build on macOS.
Member
|
This needs a rebase |
added 8 commits
April 8, 2026 09:46
Implements BPF token delegation for unprivileged BPF operations, based on the stale PR aya-rs#990 by dave-tucker, rebased and adapted to current main. BPF tokens allow unprivileged userspace programs to perform BPF operations by obtaining a token from a specially-configured BPF filesystem mounted with delegate_* options.
Author
|
Hi @tamird, It's done :) |
Member
|
I don't have the bandwidth to review 2kloc of LLM-generated code. Perhaps @alessandrod can help you. |
Closed
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.
Summary
Implements BPF token delegation for unprivileged BPF operations, based on the PR #990 of @dave-tucker, rebased and adapted to current main.
BPF tokens (Linux 6.9+) allow unprivileged userspace programs to perform BPF operations by obtaining a token from a specially-configured BPF filesystem mounted with
delegate_*options. This follows the kernel's token implementation : https://docs.kernel.org/bpf/bpf_token.htmlWhat changed
ayacrate:aya::tokenmodule withBpfToken,FilesystemPermissions,FilesystemPermissionsBuilder, andcreate_bpf_filesystemEbpfLoader::token()builder method to pass a token for loadingdetect_features_with_token()token_fdthreaded throughbpf_create_map,bpf_load_program,bpf_load_btfsyscallsFeaturesstored inMapDataandProgramDatafor correct post-load behavior (cpu_map, dev_map, perf_attach)from_pin/from_pinned_pathmethods updated to accept token + featuresaya-objcrate:Clonederive onFeaturesandBtfFeaturesBpfAttachType,BpfCommand,BpfMapType,BpfProgType,BpfLinkType(used byFilesystemPermissionsBuilder)attach,cmdaya-tool:create-fssubcommand to create a BPFFS with token delegation optionsTests:
tools/testing/selftests/bpf/prog_tests/token.c)EOPNOTSUPPwhen blocked by kernel lockdown (Secure Boot)API example
Breaking changes
Refs: #990
Added/updated tests?
Checklist
Note on testing
BPF token creation (BPF_TOKEN_CREATE syscall) is blocked by kernel lockdown in integrity mode, which is enforced by Secure Boot on Ubuntu/Fedora. Integration tests gracefully skip in that case. Full token tests require either:
This change is