]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Enable read/write access to skb metadata through a dynptr
authorJakub Sitnicki <jakub@cloudflare.com>
Thu, 14 Aug 2025 09:59:28 +0000 (11:59 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 18 Aug 2025 17:29:42 +0000 (10:29 -0700)
commit6877cd392baecf816c2ba896a9d42874628004a5
tree13fa85d0eca4b82cf9cef66df15c1da5c5f28776
parent89d912e494f786e79f69ed9d567a8842c71dbb03
bpf: Enable read/write access to skb metadata through a dynptr

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().

Note that for cloned skbs which share data with the original, we limit the
skb metadata dynptr to be read-only since we don't unclone on a
bpf_dynptr_write to metadata.

Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250814-skb-metadata-thru-dynptr-v7-2-8a39e636e0fb@cloudflare.com
include/linux/filter.h
kernel/bpf/helpers.c
net/core/filter.c