netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org, jbenc@redhat.com,
	"David Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Daniel Borkmann" <dborkman@redhat.com>,
	"Simon Horman" <horms@verge.net.au>,
	"Paul Durrant" <Paul.Durrant@citrix.com>,
	"Thomas Graf" <tgraf@suug.ch>,
	"Miklos Szeredi" <mszeredi@suse.cz>,
	=?UTF-8?q?Peter=20Pan=28=E6=BD=98=E5=8D=AB=E5=B9=B3=29?=
	<panweiping3@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 5/5] skbuff: skb_segment: orphan frags before copying
Date: Mon, 10 Mar 2014 23:52:36 +0200	[thread overview]
Message-ID: <20140310215236.GA7052@redhat.com> (raw)
In-Reply-To: <20140310213404.GB15352@gondor.apana.org.au>

On Tue, Mar 11, 2014 at 05:34:05AM +0800, Herbert Xu wrote:
> On Mon, Mar 10, 2014 at 06:29:36PM +0200, Michael S. Tsirkin wrote:
> > skb_segment copies frags around, so we need
> > to copy them carefully to avoid accessing
> > user memory after reporting completion to userspace
> > through a callback.
> > 
> > skb_segment doesn't normally happen on datapath:
> > TSO needs to be disabled - so disabling zero copy
> > in this case does not look like a big deal.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Why do we need this patch at all?

The cover letter has more detail:
	skb_segment ... moves frags
	between skbs without orphaning them.
	This causes userspace to assume it's safe to
	reuse the buffer, and receiver gets corrupted data.
	This further might leak information from the
	transmitter on the wire.

if still unclear, pls let me know.


> Contrary to what you said,
> this path is definitely performance-critical since the basis
> of being able to enable GSO by default is that it causes no
> regressions in non-TSO cases.
> 
> Cheers,

Well it's a single non taken branch.
If the branch is taken it's more expensive, but once we
take it once callback is invoked and zero copy is
disabled for future users, so it will be non taken from here on.


> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-03-10 21:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 16:29 [PATCH 0/5] skbuff: fix skb_segment with zero copy skbs Michael S. Tsirkin
2014-03-10 16:29 ` [PATCH 1/5] skbuff: skb_segment: s/frag/nskb_frag/ Michael S. Tsirkin
2014-03-10 16:29 ` [PATCH 2/5] skbuff: skb_segment: s/skb_frag/frag/ Michael S. Tsirkin
2014-03-10 16:29 ` [PATCH 3/5] skbuff: skb_segment: s/skb/head_skb/ Michael S. Tsirkin
2014-03-10 17:27 ` [PATCH 4/5] skbuff: skb_segment: s/fskb/list_skb/ Michael S. Tsirkin
2014-03-10 17:40   ` David Miller
2014-03-10 17:43     ` David Miller
2014-03-10 17:56       ` Michael S. Tsirkin
2014-03-10 20:45         ` David Miller
2014-03-10 17:28 ` [PATCH 5/5] skbuff: skb_segment: orphan frags before copying Michael S. Tsirkin
2014-03-10 21:34   ` Herbert Xu
2014-03-10 21:52     ` Michael S. Tsirkin [this message]
2014-03-10 21:56       ` Herbert Xu
2014-03-10 22:07         ` Michael S. Tsirkin
2014-03-10 22:12           ` Herbert Xu
2014-03-10 22:30             ` Michael S. Tsirkin
2014-03-11  0:39               ` Herbert Xu
2014-03-11  6:41                 ` Michael S. Tsirkin
2014-03-11  7:21                   ` Herbert Xu
2014-03-11 20:27 ` [PATCH 0/5] skbuff: fix skb_segment with zero copy skbs David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140310215236.GA7052@redhat.com \
    --to=mst@redhat.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@verge.net.au \
    --cc=jbenc@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=panweiping3@gmail.com \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).