netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gao Feng" <gfree.wind@foxmail.com>
To: "'Pablo Neira Ayuso'" <pablo@netfilter.org>, <gfree.wind@foxmail.com>
Cc: <netfilter-devel@vger.kernel.org>
Subject: RE: [PATCH nf 1/1] netfilter: cttimeout: Fix one possible use-after-free issue
Date: Fri, 14 Apr 2017 06:35:13 +0800	[thread overview]
Message-ID: <001101d2b4a6$37cbce40$a7636ac0$@foxmail.com> (raw)
In-Reply-To: <20170413214756.GA3960@salvia>

> -----Original Message-----
> From: Pablo Neira Ayuso [mailto:pablo@netfilter.org]
> On Thu, Apr 06, 2017 at 07:09:09PM +0800, gfree.wind@foxmail.com wrote:
> >
> > The function ctnl_untimeout is used to untimeout every conntrack which
> > is using the timeout. But it is necessary to add one barrier
> > synchronize_rcu because of racing. Maybe one conntrack has already
> > owned this timeout, but it is not inserted into unconfirmed list or
> > the hash list, when ctnl_untimeout untimeout the conntracks
> 
> This object is released via kfree_rcu().
> 
> You have to describe better the race scenario.

Let me describe it with a call path
CPU1     			                  CPU2
alloc new conn
add timeout ext
	
ctnl_timeout_try_del
                                   untimeout all conns in list
	
kfree_rcu.
conn is confirmed.

As the show above, when cpu2 untimeout all conns in list, the new conn of
cpu1
is not confirmed. The new conn still owns the timeout pointer. After the
timeout
mem is freed really, it points to one invalid mem.

Regards
Feng





  reply	other threads:[~2017-04-13 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 11:09 [PATCH nf 1/1] netfilter: cttimeout: Fix one possible use-after-free issue gfree.wind
2017-04-13 21:47 ` Pablo Neira Ayuso
2017-04-13 22:35   ` Gao Feng [this message]
2017-04-13 22:44     ` Pablo Neira Ayuso

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='001101d2b4a6$37cbce40$a7636ac0$@foxmail.com' \
    --to=gfree.wind@foxmail.com \
    --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).