[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130924033505.GB22393@order.stressinduktion.org>
Date: Tue, 24 Sep 2013 05:35:05 +0200
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Eric Dumazet <eric.dumazet@...il.com>,
Tom Herbert <therbert@...gle.com>, davem@...emloft.net,
netdev@...r.kernel.org, jesse.brandeburg@...el.com
Subject: Re: [PATCH 1/2] net: Toeplitz library functions
On Tue, Sep 24, 2013 at 04:30:38AM +0200, Hannes Frederic Sowa wrote:
> On Mon, Sep 23, 2013 at 05:03:11PM -0700, Eric Dumazet wrote:
> > On Mon, 2013-09-23 at 15:41 -0700, Tom Herbert wrote:
> >
> > > +#ifdef CONFIG_NET_TOEPLITZ
> > > + toeplitz_net = toeplitz_alloc();
> > > + if (!toeplitz_net)
> > > + goto out;
> > > +
> > > + toeplitz_init(toeplitz_net, NULL);
> > > +#endif
> > > +
> >
> > Hmm
> >
> > 1) Security alert here.
> >
> > Many devices (lets say Android phones) have no entropy at this point,
> > all devices will have same toeplitz key.
> >
> > Check build_ehash_secret() for a possible point for the feeding of the
> > key. (and commit 08dcdbf6a7b9d14c2302c5bd0c5390ddf122f664 )
> >
> > If hardware toeplitz is ever used, we want to make sure every host uses
> > a private and hidden Toeplitz key.
> 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)?
[PATCH] inet: initialize hash secret values on first non-kernel socket creation
Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
---
net/ipv4/af_inet.c | 5 ++---
net/ipv6/af_inet6.c | 4 +---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 7a1874b..489834a 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -286,9 +286,8 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
int try_loading_module = 0;
int err;
- if (unlikely(!inet_ehash_secret))
- if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
- build_ehash_secret();
+ if (unlikely(!inet_ehash_secret && !kern))
+ build_ehash_secret();
sock->state = SS_UNCONNECTED;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 7c96100..dbf8c35 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -110,9 +110,7 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
int try_loading_module = 0;
int err;
- if (sock->type != SOCK_RAW &&
- sock->type != SOCK_DGRAM &&
- !inet_ehash_secret)
+ if (unlikely(!inet_ehash_secret && !kern))
build_ehash_secret();
/* Look for the requested type/protocol pair. */
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists