examples: bpfman pre-load gate adapter#97
Merged
Merged
Conversation
Adapts bpfcompat to the optional PreLoadValidator hook proposed in bpfman (ErenAri/bpfman branch preload-validation-gate). bpfman defines the interface and this supplies the implementation, so bpfman itself never imports bpfcompat. The error is the deliverable: bpfman surfaces it verbatim, so a refusal carries the classification code, the verifier's reason and the errno instead of the bare EINVAL the loader would otherwise produce. Builds with and without the hostload tag; without it bpfcompat compiles to a stub that reports the feature is unavailable rather than silently passing objects. Signed-off-by: ErenAri <erenari27@gmail.com>
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.
Companion to a proposed hook in bpfman: ErenAri/bpfman@preload-validation-gate.
Design
bpfman defines a tiny interface; we supply the implementation. bpfman takes no dependency on bpfcompat — that was the constraint worth designing around, since a hard dep would be an unreasonable ask of another project.
Why the interface is shaped this way
It mirrors bpfman's existing
ProgramValidatorconvention rather than inventing a new one. The two ask different questions:ProgramValidatoris structural (do these program names exist in this object), this one is about the kernel (will the verifier accept it here). An object can name every program correctly and still be rejected for a missing helper, map type, or BTF relocation target.The error is the product. bpfman surfaces it verbatim, so a refusal carries the classification code, the verifier's own reason, and the errno — instead of the bare
EINVALthe loader produces today.Verified
managersuite passes with the patch, plus two new tests — a refusal blocks the load and leaves clean state, and the default nil validator is a no-op. (platform/image/ocifails there, but identically with my changes stashed — pre-existing.)