From: <gregkh@linuxfoundation.org>
To: fw@strlen.de, davem@davemloft.net, edumazet@google.com,
gregkh@linuxfoundation.org, ncardwell@google.com,
soheil@google.com, ycheng@google.com, yvan@vanrossomme.net
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "secure_seq: downgrade to per-host timestamp offsets" has been added to the 4.10-stable tree
Date: Sat, 29 Apr 2017 08:23:29 +0200 [thread overview]
Message-ID: <1493447009113147@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
secure_seq: downgrade to per-host timestamp offsets
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
secure_seq-downgrade-to-per-host-timestamp-offsets.patch
and it can be found in the queue-4.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From foo@baz Sat Apr 29 08:22:40 CEST 2017
From: Florian Westphal <fw@strlen.de>
Date: Sat, 25 Mar 2017 10:58:24 +0100
Subject: secure_seq: downgrade to per-host timestamp offsets
From: Florian Westphal <fw@strlen.de>
[ Upstream commit 28ee1b746f493b7c62347d714f58fbf4f70df4f0 ]
Unfortunately too many devices (not under our control) use tcp_tw_recycle=1,
which depends on timestamps being identical of the same saddr.
Although tcp_tw_recycle got removed in net-next we can't make
such end hosts disappear so downgrade to per-host timestamp offsets.
4.10 note: original patch uses siphash (added in 4.11), since
ts_off is only used to obscure uptime (and doesn't use same secret
as isn generator) this uses jhash instead.
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Reported-by: Yvan Vanrossomme <yvan@vanrossomme.net>
Fixes: 95a22caee396c ("tcp: randomize tcp timestamp offsets for each connection")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/core/secure_seq.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
--- a/net/core/secure_seq.c
+++ b/net/core/secure_seq.c
@@ -16,9 +16,11 @@
#define NET_SECRET_SIZE (MD5_MESSAGE_BYTES / 4)
static u32 net_secret[NET_SECRET_SIZE] ____cacheline_aligned;
+static u32 ts_secret[2];
static __always_inline void net_secret_init(void)
{
+ net_get_random_once(ts_secret, sizeof(ts_secret));
net_get_random_once(net_secret, sizeof(net_secret));
}
#endif
@@ -41,6 +43,21 @@ static u32 seq_scale(u32 seq)
#endif
#if IS_ENABLED(CONFIG_IPV6)
+static u32 secure_tcpv6_ts_off(const __be32 *saddr, const __be32 *daddr)
+{
+ u32 hash[4 + 4 + 1];
+
+ if (sysctl_tcp_timestamps != 1)
+ return 0;
+
+ memcpy(hash, saddr, 16);
+ memcpy(hash + 4, daddr, 16);
+
+ hash[8] = ts_secret[0];
+
+ return jhash2(hash, ARRAY_SIZE(hash), ts_secret[1]);
+}
+
u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
__be16 sport, __be16 dport, u32 *tsoff)
{
@@ -59,7 +76,7 @@ u32 secure_tcpv6_sequence_number(const _
md5_transform(hash, secret);
- *tsoff = sysctl_tcp_timestamps == 1 ? hash[1] : 0;
+ *tsoff = secure_tcpv6_ts_off(saddr, daddr);
return seq_scale(hash[0]);
}
EXPORT_SYMBOL(secure_tcpv6_sequence_number);
@@ -87,6 +104,14 @@ EXPORT_SYMBOL(secure_ipv6_port_ephemeral
#endif
#ifdef CONFIG_INET
+static u32 secure_tcp_ts_off(__be32 saddr, __be32 daddr)
+{
+ if (sysctl_tcp_timestamps != 1)
+ return 0;
+
+ return jhash_3words((__force u32)saddr, (__force u32)daddr,
+ ts_secret[0], ts_secret[1]);
+}
u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
__be16 sport, __be16 dport, u32 *tsoff)
@@ -101,7 +126,7 @@ u32 secure_tcp_sequence_number(__be32 sa
md5_transform(hash, net_secret);
- *tsoff = sysctl_tcp_timestamps == 1 ? hash[1] : 0;
+ *tsoff = secure_tcp_ts_off(saddr, daddr);
return seq_scale(hash[0]);
}
Patches currently in stable-queue which might be from fw@strlen.de are
queue-4.10/secure_seq-downgrade-to-per-host-timestamp-offsets.patch
reply other threads:[~2017-04-29 6:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1493447009113147@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=ncardwell@google.com \
--cc=soheil@google.com \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=ycheng@google.com \
--cc=yvan@vanrossomme.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;
as well as URLs for NNTP newsgroup(s).