Open
Description
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/prevail#273
Proposed solution
Support the same helper functions that Linux supports
Additional context
No response