netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH RFC nft] src: avoid re-initing core library when a second context struct is allocated
Date: Thu, 8 Aug 2019 01:37:48 +0200	[thread overview]
Message-ID: <20190807233748.qeajgrl3iokeywkx@breakpoint.cc> (raw)
In-Reply-To: <20190807224125.ysj5qyw3xxgdouc4@salvia>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Mon, Aug 05, 2019 at 11:49:17PM +0200, Florian Westphal wrote:
> > Calling nft_ctx_new() a second time leaks memory, and calling
> > nft_ctx_free a second time -- on a different context -- causes
> > double-free.
> > 
> > This patch won't work in case we assume libnftables should be
> > thread-safe, in such case we either need a mutex or move all resources
> > under nft_ctx scope.
> 
> These two should avoid the memleak / double free I think:
> 
> https://patchwork.ozlabs.org/patch/1143742/
> https://patchwork.ozlabs.org/patch/1143743/

Thanks, I will give them a try.

> Not thread-safe yet, there is a bunch global variables still in place.

I don't need thread-safety at the moment, I just found this double-free
crash when creating another nft_ctx inside nftables (don't ask why, its
fugly...)

      reply	other threads:[~2019-08-07 23:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 21:49 [PATCH RFC nft] src: avoid re-initing core library when a second context struct is allocated Florian Westphal
2019-08-07 22:41 ` Pablo Neira Ayuso
2019-08-07 23:37   ` Florian Westphal [this message]

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=20190807233748.qeajgrl3iokeywkx@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).