Skip to content
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

Added helper module for easier BTF object manipulation #530

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

qjerome
Copy link
Contributor

@qjerome qjerome commented Feb 23, 2023

Created a new module under btf module. The goal of this module is to provide higher level APIs to query BTF objects.
For the moment, APIs provide access to:

  • search a structure inside BTF and return a helper object
  • StructHelper object provides APIs to:
    • Get the size of a BTF structure (aligned and unaligned)
    • Query MemberHelper objects
  • MemberHelper provide APIs to:
    • Access the relative offset (from structure) where to find the member
    • Get the size of the structure member (aligned and unaligned)

An example scenario of the implemented feature would be to give an easy access to information needed to implement CO-RE (whenever builtin CO-RE is not possible) manually by passing structure(s)/member(s) information down to eBPF.


This change is Reviewable

@netlify
Copy link

netlify bot commented Feb 23, 2023

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 0811203
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/645f9b99be4a0e0008feaf5f
😎 Deploy Preview https://deploy-preview-530--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@qjerome qjerome changed the title Added helper module for easier BTF object manipublation Added helper module for easier BTF object manipulation Feb 23, 2023
@dave-tucker dave-tucker added the aya-obj Relating to the aya-obj crate label Feb 23, 2023
  * typedef were not handled properly and were generating wrong offsets
  * anonymous structures were not handled properly and were generating garbage members

Signed-off-by: Quentin JEROME <[email protected]>
 - When typedefs are nested
 - Offset issue when dealing with arrays

Signed-off-by: Quentin JEROME <[email protected]>
 - duplicated members under some conditions (it was not causing any functional issue)

Signed-off-by: Quentin JEROME <[email protected]>
@tamird
Copy link
Member

tamird commented Nov 22, 2024

An example scenario of the implemented feature would be to give an easy access to information needed to implement CO-RE (whenever builtin CO-RE is not possible) manually by passing structure(s)/member(s) information down to eBPF.

Does this PR provide any value until the rest of this functionality is built?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-obj Relating to the aya-obj crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants