All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Florian Westphal <fw@strlen.de>,
	"David S . Miller" <davem@davemloft.net>,
	Linux NetDev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH 2/2] netfilter: revert "conntrack: silent a memory leak warning"
Date: Thu, 17 Oct 2019 11:30:51 -0700	[thread overview]
Message-ID: <CAHo-OoxQ04vvBB-eO8_5MJLfWyy-fdvC_73TF0QfacH6Bg8d=Q@mail.gmail.com> (raw)
In-Reply-To: <CAM_iQpV7D73p7k=806u+2vxiDDK-ecFuW5Rbk6j_BDO0K-FEGg@mail.gmail.com>

> 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...

  reply	other threads:[~2019-10-17 18:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  5:35 [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in Maciej Żenczykowski
2019-10-08  5:35 ` [PATCH 2/2] netfilter: revert "conntrack: silent a memory leak warning" Maciej Żenczykowski
2019-10-08  5:38   ` Maciej Żenczykowski
2019-10-08  5:58   ` Cong Wang
2019-10-08  6:04   ` Florian Westphal
2019-10-08  6:45     ` Maciej Żenczykowski
2019-10-08  7:10       ` Maciej Żenczykowski
2019-10-10 18:36         ` Cong Wang
2019-10-17 18:30           ` Maciej Żenczykowski [this message]
2019-10-08  6:01 ` [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in Florian Westphal
2019-10-08  6:05 ` Cong Wang

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='CAHo-OoxQ04vvBB-eO8_5MJLfWyy-fdvC_73TF0QfacH6Bg8d=Q@mail.gmail.com' \
    --to=zenczykowski@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=xiyou.wangcong@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.