From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v1] net: ipv6: fix racey clock check in route cache aging logic Date: Thu, 25 Oct 2018 15:15:04 -0700 Message-ID: <9ce74f5b-387d-b02f-2efa-f12c1450577c@gmail.com> References: <20181025211352.112096-1-brendanhiggins@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "David S . Miller" , kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, Linux Kernel Mailing List To: Brendan Higgins Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 10/25/2018 02:46 PM, Brendan Higgins wrote: > On Thu, Oct 25, 2018 at 2:40 PM Eric Dumazet wrote: >> On 10/25/2018 02:13 PM, Brendan Higgins wrote: > >>> >>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c >>> index 2a7423c394560..54d28b91fd840 100644 >>> --- a/net/ipv6/route.c >>> +++ b/net/ipv6/route.c >>> @@ -1734,7 +1734,7 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket, >>> rt6_remove_exception(bucket, rt6_ex); >>> return; >>> } >>> - } else if (time_after(jiffies, rt->dst.expires)) { >>> + } else if (time_after(now, rt->dst.expires)) { >>> RT6_TRACE("purging expired route %p\n", rt); >>> rt6_remove_exception(bucket, rt6_ex); >>> return; >>> >> >> >> I do not think there is a bug here ? >> >> As a matter of fact, using the latest value of jiffies is probably better, >> since in some cases the @now variable could be quite in the past. > > Then why do we pass the `now` parameter in at all and use it at all, > like here: https://elixir.bootlin.com/linux/latest/source/net/ipv6/route.c#L1764 > ? > > I am still skeptical that we should check jiffies in each check, but > we should at least be consistent. Well, this is a case where we do not really care. When a bug is fixed (you added a Fixes: tag which is good), we want to understand the real problem that needs to be fixed on stable kernels. Since this does not seem to be a real issue, I would suggest you send a cleanup patch when net-next is open (few days after linux-4.20-rc1 is release)