ebpf: defer batch API probe for batch lookup#2018
Open
arunsingh wants to merge 1 commit into
Open
Conversation
Author
|
Ready for review. I kept the change limited to BatchLookup/BatchLookupAndDelete via batchLookupCmd(), with ENOENT behavior unchanged. The focused regression and root package tests pass on a Linux VM; details are in the PR description. |
dylandreimerink
requested changes
May 27, 2026
Member
dylandreimerink
left a comment
There was a problem hiding this comment.
Thank you! Change seems good to me, just want to change the regression test.
Signed-off-by: Arun Singh <arunsingh.in@gmail.com>
9e63c4a to
20c3fb2
Compare
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.
Fixes #2013.
BatchLookup()andBatchLookupAndDelete()previously calledhaveBatchAPI()before attempting the actual batch lookup syscall. The feature probe creates a temporary map, which can requireCAP_BPF, so a process that only needs to read from an already-open map could fail before trying the operation that would otherwise succeed.This defers the batch API feature probe until after a non-
ENOENTlookup syscall failure, matching the existingBatchUpdate()andBatchDelete()behavior. The normal end-of-iterationENOENTpath remains unchanged.The regression test creates maps while privileged, drops all effective capabilities, then verifies batch lookup, update, and delete through the existing map FDs.
Tested:
go test -exec sudo -run '^(TestHaveBatchAPI|TestMapBatch|TestMapBatchUnprivileged|TestMapBatchCursorReuse)$' .git diff --check -- map.go map_test.go