Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1309701
| From | Eric Dumazet <eric.dumazet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout |
| Date | 2016-01-14 23:10 +0100 |
| Message-ID | <qQYfF-533-15@gated-at.bofh.it> (permalink) |
| References | (6 earlier) <qQUYq-2y6-7@gated-at.bofh.it> <qQV86-2CA-15@gated-at.bofh.it> <qQVB8-34k-15@gated-at.bofh.it> <qQW4a-3gr-15@gated-at.bofh.it> <qQWGT-3K7-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2016-01-14 at 20:23 +0000, Haiyang Zhang wrote:
>
> For non-random inputs, I used the port selection of iperf that increases
> the port number by 2 for each connection. Only send-port numbers are
> different, other values are the same. I also tested some other fixed
> increment, Toeplitz spreads the connections evenly. For real applications,
> if the load came from local area, then the IP/port combinations are
> likely to have some non-random patterns.
We are not putting code in core networking stack favoring non secure
behavior.
The +2 behavior for connections from A to B:<fixed port> is something
that we will eventually remove in the future. It used to be +1 not a
long time ago...
Say if we implement the following,
https://tools.ietf.org/html/rfc6056#section-3.3.4
The fact that Toeplitz hash has this linear property should not be a
valid reason to help hackers to exploit vulnerabilities.
In my tests I was using netperf, which randomizes both source &
destination ports.
This is why I could not reproduce your results based on iperf, which
generates 5-tuple in a totally predictable way.
This reminds me some drivers had a well known Toeplitz RSS key, allowing
attackers to direct their attack on a single queue.
I guess we could replace sk_txhash generator by a simple linear
allocator and boom, your driver will be pleased.
But this is only for a very specific workload.
diff --git a/include/net/sock.h b/include/net/sock.h
index e830c1006935..949527413cfb 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1689,7 +1689,8 @@ unsigned long sock_i_ino(struct sock *sk);
static inline u32 net_tx_rndhash(void)
{
- u32 v = prandom_u32();
+ static u32 last_hash;
+ u32 v = ++last_hash; // do not care about SMP races.
return v ?: 1;
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-01-07 10:40 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-07 14:00 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-01-07 14:30 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout John Fastabend <john.fastabend@gmail.com> - 2016-01-08 02:10 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout KY Srinivasan <kys@microsoft.com> - 2016-01-08 04:50 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout John Fastabend <john.fastabend@gmail.com> - 2016-01-08 07:20 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout KY Srinivasan <kys@microsoft.com> - 2016-01-08 19:10 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-08 22:10 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Tom Herbert <tom@herbertland.com> - 2016-01-09 01:20 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout David Miller <davem@davemloft.net> - 2016-01-10 23:30 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-14 00:30 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout David Miller <davem@davemloft.net> - 2016-01-14 06:00 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Tom Herbert <tom@herbertland.com> - 2016-01-14 18:20 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-01-14 19:00 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-14 19:30 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-14 19:40 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Tom Herbert <tom@herbertland.com> - 2016-01-14 19:50 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-14 20:20 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Tom Herbert <tom@herbertland.com> - 2016-01-14 20:50 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-14 21:30 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Tom Herbert <tom@herbertland.com> - 2016-01-14 22:50 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout David Miller <davem@davemloft.net> - 2016-01-14 23:10 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-14 23:10 +0100
RE: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Haiyang Zhang <haiyangz@microsoft.com> - 2016-01-14 23:50 +0100
Re: [PATCH net-next] hv_netvsc: don't make assumptions on struct flow_keys layout Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-14 19:00 +0100
csiph-web