Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Bruce \"Brutus\" Curtis" <brutus@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v3] net-tcp: TCP/IP stack bypass for loopback connections
Date: Mon, 17 Sep 2012 22:20:39 +0200	[thread overview]
Message-ID: <1347913239.26523.173.camel@edumazet-glaptop> (raw)
In-Reply-To: <1347908305-13541-1-git-send-email-brutus@google.com>

On Mon, 2012-09-17 at 11:58 -0700, Bruce "Brutus" Curtis wrote:
> From: "Bruce \"Brutus\" Curtis" <brutus@google.com>
> 
> TCP/IP loopback socket pair stack bypass, based on an idea by, and
> rough upstream patch from, David Miller <davem@davemloft.net> called
> "friends", the data structure modifcations and connection scheme are
> reused with extensive data-path changes.

...

>  
> +		if (skb->friend) {
> +			/*
> +			 * If friends haven't been made yet, our sk_friend
> +			 * still == NULL, then update with the ACK's friend
> +			 * value (the listen()er's sock addr) which is used
> +			 * as a place holder.
> +			 */
> +			cmpxchg(&sk->sk_friend, NULL, skb->friend);
> +		}


There is a fundamental issue with this patch

Setting skb->friend to a socket structure, without holding a reference
on it is going to add subtle races and bugs.

In this code, we have no guarantee the socket pointed by skb->friend was
eventually freed and/or reused.

But adding references might be overkill, as we need to unref them in
some places, in hot path.

  reply	other threads:[~2012-09-17 20:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 18:58 [PATCH v3] net-tcp: TCP/IP stack bypass for loopback connections Bruce "Brutus" Curtis
2012-09-17 20:20 ` Eric Dumazet [this message]
2012-09-17 23:08   ` Bruce Curtis
2012-09-19 20:34   ` David Miller
2012-09-19 21:03     ` Eric Dumazet
2012-09-19 21:17       ` David Miller
2012-09-19 21:19       ` Bruce Curtis
2012-09-20 11:28         ` Stephen Clark
2012-09-20 11:51           ` Eric Dumazet
2012-09-20 16:21             ` Bill Fink
2012-09-20 17:24             ` Rick Jones
2012-09-20 19:41               ` David Miller
2012-09-20 19:30           ` 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=1347913239.26523.173.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=brutus@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    /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