[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67ebb94d-c73f-6c9f-493b-00c86f595120@gmail.com>
Date: Mon, 18 Jun 2018 08:59:34 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Arnd Bergmann <arnd@...db.de>, Harsh Jain <harsh@...lsio.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Atul Gupta <atul.gupta@...lsio.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: y2038@...ts.linaro.org, Michael Werner <werner@...lsio.com>,
Neal Cardwell <ncardwell@...gle.com>,
Yuchung Cheng <ycheng@...gle.com>,
Soheil Hassas Yeganeh <soheil@...gle.com>,
Florian Westphal <fw@...len.de>,
Christoph Paasch <cpaasch@...le.com>,
Lawrence Brakmo <brakmo@...com>,
Ursula Braun <ubraun@...ux.vnet.ibm.com>,
Priyaranjan Jha <priyarjha@...gle.com>,
Alexei Starovoitov <ast@...nel.org>,
David Ahern <dsahern@...il.com>,
Ivan Delalande <colona@...sta.com>,
Maciej Żenczykowski <maze@...gle.com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next 3/3] tcp: use monotonic timestamps for PAWS
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 !
Powered by blists - more mailing lists