Messages in this thread | | | Date | Thu, 3 Aug 2023 20:53:16 +0300 | From | Andrew Kanner <> | Subject | Re: [PATCH v4 1/2] drivers: net: prevent tun_build_skb() to exceed the packet size limit |
| |
On Thu, Aug 03, 2023 at 11:19:47AM +0800, Jason Wang wrote: > > > @@ -1594,7 +1597,13 @@ static bool tun_can_build_skb(struct tun_struct *tun, struct tun_file *tfile, > > > if (zerocopy) > > > return false; > > > > > > - if (SKB_DATA_ALIGN(len + TUN_RX_PAD) + > > > + rcu_read_lock(); > > > + xdp_prog = rcu_dereference(tun->xdp_prog); > > > + if (xdp_prog) > > > + pad += XDP_PACKET_HEADROOM; > > > + rcu_read_unlock(); > > > + > > > > Isolated seen, I guess, this is a correct fix to 7df13219d757. > > I think so. > > Actually, I think we can probably always count XDP_PACKET_HEADROOM > here. Since there's a window that XDP program might be attached in the > middle of tun_can_build_skb() and tun_build_skb().
Thanks, that makes sense. I will do it in v5.
> > Question to Jason Wang: > > Why fall back (to e.g. tun_alloc_skb()) when size is above PAGE_SIZE? > > > > AFAIK tun_build_skb() *can* create get larger packets than PAGE_SIZE > > from it's page_frag. Is there a reason for this limitation? > > I couldn't recall but I think we can relax.
Jesper already sent enough info for this idea in v2, I will use it for the next patch/series.
Jesper, I will add this tag for this next patch/series if you don't mind: Suggested-by: Jesper Dangaard Brouer <hawk@kernel.org>
-- Andrew Kanner
| |