On Mon, 2025-07-21 at 12:52 +0200, Jakub Sitnicki wrote: [...] > diff --git a/net/core/filter.c b/net/core/filter.c > index c17b628c08f5..4b787c56b220 100644 > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -11978,6 +11978,18 @@ bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) > return func; > } > > +int bpf_skb_meta_load_bytes(const struct sk_buff *skb, u32 offset, > + void *dst, u32 len) > +{ > + u32 meta_len = skb_metadata_len(skb); > + > + if (len > meta_len || offset > meta_len - len) > + return -E2BIG; /* out of bounds */ > + > + memmove(dst, skb_metadata_end(skb) - meta_len + offset, len); > + return 0; > +} > + Nit: is it possible to use bpf_skb_meta_pointer() here to avoid duplicating range check in both bpf_skb_meta_load_bytes() and bpf_skb_meta_store_bytes()? > static int dynptr_from_skb_meta(struct __sk_buff *skb_, u64 flags, > struct bpf_dynptr *ptr_, bool rdonly) > {