Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hoang Le <hoang.h.le@dektech.com.au>,
	'Eric Dumazet' <eric.dumazet@gmail.com>,
	jon.maloy@ericsson.com, maloy@donjonn.com,
	tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [net-next] tipc: improve throughput between nodes in netns
Date: Mon, 21 Oct 2019 20:57:50 -0700	[thread overview]
Message-ID: <3380c6dc-9988-9c67-261a-d6f7d68c7cc7@gmail.com> (raw)
In-Reply-To: <004401d58889$8a3ba740$9eb2f5c0$@dektech.com.au>



On 10/21/19 8:33 PM, Hoang Le wrote:
> Hi Eric,
> 
> Thanks for quick feedback.
> See my inline answer.
> 
> Regards,
> Hoang
> -----Original Message-----
> From: Eric Dumazet <eric.dumazet@gmail.com> 
> Sent: Tuesday, October 22, 2019 9:41 AM
> To: Hoang Le <hoang.h.le@dektech.com.au>; jon.maloy@ericsson.com; maloy@donjonn.com; tipc-discussion@lists.sourceforge.net; netdev@vger.kernel.org
> Subject: Re: [net-next] tipc: improve throughput between nodes in netns
> 
> 
> On 10/21/19 7:20 PM, Hoang Le wrote:
>>  	n->net = net;
>>  	n->capabilities = capabilities;
>> +	n->pnet = NULL;
>> +	for_each_net_rcu(tmp) {
> 
> This does not scale well, if say you have a thousand netns ?
> [Hoang] This check execs only once at setup step. So we get no problem with huge namespaces.
> 
>> +		tn_peer = net_generic(tmp, tipc_net_id);
>> +		if (!tn_peer)
>> +			continue;
>> +		/* Integrity checking whether node exists in namespace or not */
>> +		if (tn_peer->net_id != tn->net_id)
>> +			continue;
>> +		if (memcmp(peer_id, tn_peer->node_id, NODE_ID_LEN))
>> +			continue;
>> +
>> +		hash_chk = tn_peer->random;
>> +		hash_chk ^= net_hash_mix(&init_net);
> 
> Why the xor with net_hash_mix(&init_net) is needed ?
> [Hoang] We're trying to eliminate a sniff at injectable discovery message. 
> Building hash-mixes as much as possible is to prevent fake discovery messages.
> 
>> +		hash_chk ^= net_hash_mix(tmp);
>> +		if (hash_chk ^ hash_mixes)
>> +			continue;
>> +		n->pnet = tmp;
>> +		break;
>> +	}
> 
> 
> How can we set n->pnet without increasing netns ->count ?
> Using check_net() later might trigger an use-after-free.
> 
> [Hoang] In this case, peer node is down. I assume the tipc xmit function already bypassed these lines.
> 

I assume nothing. I prefer evidences :)

It seems that the netns could go down later, you need some
kind of notifier to be able to purge queues/objects having a pointer to a dismantling netns.

Keeping pointers without proper refcount (get_net() or maybe_get_net()) is a recipe for disasters.

      reply	other threads:[~2019-10-22  3:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  2:20 [net-next] tipc: improve throughput between nodes in netns Hoang Le
2019-10-22  2:40 ` Eric Dumazet
2019-10-22  3:33   ` Hoang Le
2019-10-22  3:57     ` Eric Dumazet [this message]

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=3380c6dc-9988-9c67-261a-d6f7d68c7cc7@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=hoang.h.le@dektech.com.au \
    --cc=jon.maloy@ericsson.com \
    --cc=maloy@donjonn.com \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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