Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1304479

Re: [PATCH] net: preserve IP control block during GSO segmentation

From Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] net: preserve IP control block during GSO segmentation
Date 2016-01-08 13:30 +0100
Message-ID <qOEl4-6Dm-13@gated-at.bofh.it> (permalink)
References <qOE1J-6uc-45@gated-at.bofh.it> <qOEbo-6yE-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 08, 2016 at 12:13:49PM +0000, David Laight wrote:
> From: Of Konstantin Khlebnikov
> > Sent: 08 January 2016 12:01
> > Skb_gso_segment() uses skb control block during segmentation.
> > This patch adds 32-bytes room for previous control block which
> > will be copied into all resulting segments.
> > 
> > This patch fixes kernel crash during fragmenting forwarded packets.
> > Fragmentation requires valid IP CB in skb for clearing ip options.
> > Also patch removes custom save/restore in ovs code, now it's redundant.
> > 
> ...
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index 4355129fff91..9147f9f34cbe 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -3446,7 +3446,8 @@ struct skb_gso_cb {
> >  	int	encap_level;
> >  	__u16	csum_start;
> >  };
> > -#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
> > +#define SKB_SGO_CB_OFFSET	32
> > +#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET))
> 
> You could set SKB_SGO_CB_OFFSET to sizeof ((skb)->cb) - sizeof (struct skb_gso_cb)
> so that the end of 'cb' is always used.
> (Assuming the former is a multiple of 4.)
> 
> It might be worth using an on-stack structure passed through as a separate
> parameter - it doesn't look as though it has to be queued with the skb.
> (Clearly a bigger change.)
> 

I considered that as an option. But the bigger change and the use of the extra
stack for all users, plus the extra parameters indicated I should go the other
way.

In my opinion, at least in the IP fragmentation case, saving/restoring cb is not
such a big problem since we are in slow path already.

Cascardo.

> 	David
> 

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: preserve IP control block during GSO segmentation Konstantin Khlebnikov <koct9i@gmail.com> - 2016-01-08 13:10 +0100
  Re: [PATCH] net: preserve IP control block during GSO segmentation Konstantin Khlebnikov <koct9i@gmail.com> - 2016-01-08 13:20 +0100
  RE: [PATCH] net: preserve IP control block during GSO segmentation David Laight <David.Laight@ACULAB.COM> - 2016-01-08 13:20 +0100
    Re: [PATCH] net: preserve IP control block during GSO segmentation Thadeu Lima de Souza Cascardo <cascardo@redhat.com> - 2016-01-08 13:30 +0100
    Re: [PATCH] net: preserve IP control block during GSO segmentation Zang MingJie <zealot0630@gmail.com> - 2016-01-11 09:20 +0100
      Re: [PATCH] net: preserve IP control block during GSO segmentation Cong Wang <xiyou.wangcong@gmail.com> - 2016-01-12 02:00 +0100
  Re: [PATCH] net: preserve IP control block during GSO segmentation Thadeu Lima de Souza Cascardo <cascardo@redhat.com> - 2016-01-08 13:20 +0100

csiph-web