From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Frederic Sowa Subject: Re: [PATCH 1/2] net: Toeplitz library functions Date: Tue, 24 Sep 2013 07:45:32 +0200 Message-ID: <20130924054532.GA24446@order.stressinduktion.org> References: <1379980991.3165.37.camel@edumazet-glaptop> <20130924023038.GA22393@order.stressinduktion.org> <20130924033505.GB22393@order.stressinduktion.org> <1380001118.3165.41.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Tom Herbert , davem@davemloft.net, netdev@vger.kernel.org, jesse.brandeburg@intel.com To: Eric Dumazet Return-path: Received: from order.stressinduktion.org ([87.106.68.36]:46847 "EHLO order.stressinduktion.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710Ab3IXFpe (ORCPT ); Tue, 24 Sep 2013 01:45:34 -0400 Content-Disposition: inline In-Reply-To: <1380001118.3165.41.camel@edumazet-glaptop> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Sep 23, 2013 at 10:38:38PM -0700, Eric Dumazet wrote: > On Tue, 2013-09-24 at 05:35 +0200, Hannes Frederic Sowa wrote: > > > > build_ehash_secret builds up the data which seeds fragmentation ids, ephermal > > > port randomization etc. Could we drop the check of sock->type? I guess the > > > idea was that in-kernel sockets of type raw/udp do not seed the keys when no > > > entropy is available? > > > > Would this be better (I checked inet_ehash_secret, ipv6_hash_secret > > and net_secret to actual get initialized)? > > > > inet_ehash_secret is used only to make jhash() for tcp ehash, not for > fragmentation ids or other uses (port randomization). > > > > [PATCH] inet: initialize hash secret values on first non-kernel socket creation > > > > Signed-off-by: Hannes Frederic Sowa > > --- > > Why ? This looks buggy to me. It does initialize the rest of the key values (net_secret_init), too: 258 void build_ehash_secret(void) 259 { 260 u32 rnd; 261 262 do { 263 get_random_bytes(&rnd, sizeof(rnd)); 264 } while (rnd == 0); 265 266 if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0) { 267 get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); 268 net_secret_init(); 269 } 270 } Maybe I overlooked something? Thanks, Hannes