From: Eric Dumazet <eric.dumazet@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>, Harsh Jain <harsh@chelsio.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Atul Gupta <atul.gupta@chelsio.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: y2038@lists.linaro.org, "Michael Werner" <werner@chelsio.com>,
"Neal Cardwell" <ncardwell@google.com>,
"Yuchung Cheng" <ycheng@google.com>,
"Soheil Hassas Yeganeh" <soheil@google.com>,
"Florian Westphal" <fw@strlen.de>,
"Christoph Paasch" <cpaasch@apple.com>,
"Lawrence Brakmo" <brakmo@fb.com>,
"Ursula Braun" <ubraun@linux.vnet.ibm.com>,
"Priyaranjan Jha" <priyarjha@google.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"David Ahern" <dsahern@gmail.com>,
"Ivan Delalande" <colona@arista.com>,
"Maciej Żenczykowski" <maze@google.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next 3/3] tcp: use monotonic timestamps for PAWS
Date: Mon, 18 Jun 2018 08:59:34 -0700 [thread overview]
Message-ID: <67ebb94d-c73f-6c9f-493b-00c86f595120@gmail.com> (raw)
In-Reply-To: <20180618152242.1566661-3-arnd@arndb.de>
On 06/18/2018 08:22 AM, Arnd Bergmann wrote:
> Using get_seconds() for timestamps is deprecated since it can lead
> to overflows on 32-bit systems. While the interface generally doesn't
> overflow until year 2106, the specific implementation of the TCP PAWS
> algorithm breaks in 2038 when the intermediate signed 32-bit timestamps
> overflow.
>
...
>
>
> static inline u32 tcp_cookie_time(void)
> @@ -1361,7 +1362,7 @@ static inline bool tcp_paws_check(const struct tcp_options_received *rx_opt,
> {
> if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
> return true;
> - if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
> + if (unlikely(ktime_get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
> return true;
> /*
> * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0,
> @@ -1391,7 +1392,7 @@ static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt,
>
> However, we can relax time bounds for RST segments to MSL.
> */
> - if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
> + if (rst && ktime_get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
> return false;
> return true;
Please use the time_after32(), since ktime_get_seconds() is time64_t while ts_recent_stamp is int.
Same remark for tcp_twsk_unique()
Lets clean up this stuff, thanks !
next prev parent reply other threads:[~2018-06-18 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 15:22 [PATCH net-next 1/3] xfrm: use time64_t for in-kernel timestamps Arnd Bergmann
2018-06-18 15:22 ` [PATCH net-next 2/3] ipv6: xfrm: use 64-bit timestamps Arnd Bergmann
2018-06-18 15:22 ` [PATCH net-next 3/3] tcp: use monotonic timestamps for PAWS Arnd Bergmann
2018-06-18 15:59 ` Eric Dumazet [this message]
2018-06-19 9:23 ` Arnd Bergmann
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=67ebb94d-c73f-6c9f-493b-00c86f595120@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=atul.gupta@chelsio.com \
--cc=brakmo@fb.com \
--cc=colona@arista.com \
--cc=cpaasch@apple.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=gustavo@embeddedor.com \
--cc=harsh@chelsio.com \
--cc=herbert@gondor.apana.org.au \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maze@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=priyarjha@google.com \
--cc=soheil@google.com \
--cc=ubraun@linux.vnet.ibm.com \
--cc=werner@chelsio.com \
--cc=y2038@lists.linaro.org \
--cc=ycheng@google.com \
--cc=yoshfuji@linux-ipv6.org \
/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).