Subject: Re: [PATCH net-next] xdp: add multi-buff support for xdp running in generic mode

From: Jakub Kicinski <[email-masked]>
Date: Tue, 28 Nov 2023 10:51:45 -0800

On Tue, 28 Nov 2023 18:29:20 +0100 Lorenzo Bianconi wrote:
> @Jakub: iirc we were discussing something similar for veth [0].
> Here pskb_expand_head() reallocates skb paged data (skb_shinfo()->frags[])
> just if the skb is cloned and if it is zero-copied [1] while in skb_cow_data()
> we always reallocate the paged area if skb_shinfo()->nr_frags is set [2].
> Since the eBPF program can theoretically modify paged data, I would say we
> should do the same we did for veth even here, right?

Yes, don't we allow writes to fragments in XDP based on the assumption
that it runs on Rx so that paged data must not be zero copy?
bpf_xdp_store_bytes() doesn't seem to have any checks which would
stop it from writing fragments, as far as I can see.

I don't see how we can ever correctly support this form of mbuf for veth
or generic XDP :(