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

Support BPF dynamic pointers #3515

Open
dthaler opened this issue May 2, 2024 · 0 comments
Open

Support BPF dynamic pointers #3515

dthaler opened this issue May 2, 2024 · 0 comments
Labels
blocked Blocked on another issue that must be done first enhancement New feature or request help wanted Extra attention is needed triaged Discussed in a triage meeting
Milestone

Comments

@dthaler
Copy link
Collaborator

dthaler commented May 2, 2024

Describe the feature you'd like supported

Linux supports memory allocation, access, and release via helper functions.

 struct bpf_dynptr_kern {
 void *data;
 u32 size;
 u32 offset;
 } __aligned(8);

 /* Dynamically allocate memory */
 bpf_dynptr_alloc(size, 0, &ptr);

 /* Get a dynptr to __sk_buff data */
 bpf_dynptr_from_skb(skb, &skb_ptr);

 /* Get a dynptr to xdp_md data */
 bpf_dynptr_from_xdp(ctx, &xdp_ptr);

 /* Advance the ptr into skb->data */
 bpf_dynptr_advance(&skb_ptr, sizeof(struct ethhdr));

 /* Write into the memory */
 bpf_dynptr_write(&ptr, 0, buf, sizeof(buf));

 /* Release the memory allocation */
 bpf_dynptr_put(&ptr);

References:

Support is blocked on vbpf/ebpf-verifier#273

Proposed solution

Support the same helper functions that Linux supports

Additional context

No response

@dthaler dthaler added the enhancement New feature or request label May 2, 2024
@dahavey dahavey added triaged Discussed in a triage meeting blocked Blocked on another issue that must be done first help wanted Extra attention is needed labels May 6, 2024
@dahavey dahavey added this to the Backlog milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on another issue that must be done first enhancement New feature or request help wanted Extra attention is needed triaged Discussed in a triage meeting
Projects
None yet
Development

No branches or pull requests

2 participants