[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHo-OoxQ04vvBB-eO8_5MJLfWyy-fdvC_73TF0QfacH6Bg8d=Q@mail.gmail.com>
Date: Thu, 17 Oct 2019 11:30:51 -0700
From: Maciej Żenczykowski <zenczykowski@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: Florian Westphal <fw@...len.de>,
"David S . Miller" <davem@...emloft.net>,
Linux NetDev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Pablo Neira Ayuso <pablo@...filter.org>
Subject: Re: [PATCH 2/2] netfilter: revert "conntrack: silent a memory leak warning"
> So you conclude as it is not leak too? Then what are you trying to
> fix?
I conclude there is no easily *visible* leak.
At least not at first glance - not with single threaded code.
> I am becoming more confused after this. :-/
I think adding kmemleak_not_leak() is hiding the fact that there
actually is a leak.
I think the leak is far more subtle. Possibly some sort of race
condition or something.
I don't see it though.
The rcu doesn't seem entirely kosher, but I know little about such things.
And I think the leak is *still* here.
After all kmemleak_not_leak is purely annotation.
It doesn't fix any leaks, it just makes us not warn about them.
> > Basically AFAICT our use of __krealloc() is exactly like krealloc()
> > except instead of kfree() we do kfree_rcu().
> >
> > And thus I don't understand the need for kmemleak_not_leak(old).
>
> kfree_rcu() is a callback deferred after a grace period, so if we
> allocate the memory again before that callback, it is reported to
> kmemleak as a memory leak unless we mark it as not, right?
>
> Or kfree_rcu() works nicely with kmemleak which I am not aware
> of?
We have kfree_rcu() all over the kernel, but there's very few
kmemleak_not_leak's.
I don't see how kfree_rcu() could not work nicely with kmemleak.
If it didn't we'd have it reporting leaks all over the place...
Powered by blists - more mailing lists