-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for all eBPF helpers #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 takes over from #63 to add support for all available eBPF helpers.