Thread (2 messages) flat view 2 messages, 2 authors, 2025-07-25

Re: [PATCH bpf-next v4 2/8] bpf: Enable read/write access to skb metadata through a dynptr

From: Jakub Sitnicki <jakub@cloudflare.com>
Date: 2025-07-25 09:43:22
Also in: bpf

On Thu, Jul 24, 2025 at 01:53 PM +02, Jakub Sitnicki wrote:
On Wed, Jul 23, 2025 at 05:30 PM -07, Jakub Kicinski wrote:
quoted
On Wed, 23 Jul 2025 19:36:47 +0200 Jakub Sitnicki wrote:
quoted
Now that we can create a dynptr to skb metadata, make reads to the metadata
area possible with bpf_dynptr_read() or through a bpf_dynptr_slice(), and
make writes to the metadata area possible with bpf_dynptr_write() or
through a bpf_dynptr_slice_rdwr().
What are the expectations around the writes? Presumably we could have
two programs writing into the same metadata if the SKB is a clone, no?
[...]
Taking about the next step, once skb metadata is preserved past the TC
hook - here my impression from Netdev was that the least suprising thing
to do will be to copy-on-clone or copy-on-write (if we can pull it off).
Now that Martin has enlightened me [1] how things work today for skb
payload dynptr's, I will first try to follow the same approach, that is:

Make a copy of skb metadata before the BPF program runs, if the program
may write to the metadata.

[1] https://lore.kernel.org/all/0190e181-c592-454a-a99b-5ec361ce84e9@linux.dev/ (local)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help