Conversation
…/helper_utils, enable array to ptr conversion in skb_store_bytes
…size, wrap it in get_or_crate_ptr_from_arg to use in bpf_helper_handler
Collaborator
Author
|
Merging this in the current state to work on the blazesym example. Will pick this up again later. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for several new BPF helper functions and refactors the temporary variable allocation system to be type-aware. The changes enable helper functions like random(), probe_read(), smp_processor_id(), uid(), and skb_store_bytes() to work correctly with their specific parameter and return types.
Key changes:
- Refactored temporary variable allocation from counter-based to type-aware dictionary-based system
- Added five new BPF helper functions with proper type signatures
- Enhanced helper registry to track parameter and return types for each helper
- Updated argument handling to support type-specific temporary variables
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
pythonbpf/helper/helper_registry.py |
Added HelperSignature dataclass and type signature tracking methods |
pythonbpf/helper/helpers.py |
Added stub implementations for new helper functions |
pythonbpf/helper/bpf_helper_handler.py |
Implemented emitters for five new BPF helpers with type signatures |
pythonbpf/helper/helper_utils.py |
Refactored ScratchPoolManager to use type-aware counters and enhanced argument handling |
pythonbpf/helper/printk_formatter.py |
Refactored to use centralized get_char_array_ptr_and_size utility |
pythonbpf/functions/functions_pass.py |
Updated temp counting to track types per helper parameter |
pythonbpf/allocation_pass.py |
Refactored temp pool allocation to be type-aware |
pythonbpf/helper/__init__.py |
Exported new helper functions |
tests/passing_tests/helpers/*.py |
Added test files for new helpers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This takes over from #63 to add support for all available eBPF helpers.