netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@163.com>
Cc: netfilter-devel@vger.kernel.org, cernekee@chromium.org,
	fgao@ikuai8.com, Liping Zhang <zlpnobody@gmail.com>
Subject: Re: [PATCH nf V2] netfilter: ctnetlink: make it safer when updating ct->status
Date: Fri, 14 Apr 2017 01:25:55 +0200	[thread overview]
Message-ID: <20170413232555.GA7517@salvia> (raw)
In-Reply-To: <1492088027-10389-1-git-send-email-zlpnobody@163.com>

On Thu, Apr 13, 2017 at 08:53:47PM +0800, Liping Zhang wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
> 
> User can update the ct->status via nfnetlink, but using a non-atomic
> operation "ct->status |= status;". This is unsafe, and may clear
> IPS_DYING_BIT bit set by another CPU unexpectedly. For example:
>          CPU0                            CPU1
>   ctnetlink_change_status        __nf_conntrack_find_get
>       old = ct->status              nf_ct_gc_expired
>           -                         nf_ct_kill
>           -                      test_and_set_bit(IPS_DYING_BIT
>       new = old | status;                 -
>   ct->status = new; <-- oops, _DYING_ is cleared!

This is fixing an issue that was introduced in ca7433df3a67.

So I would like this comes in a patch batch including the several
patches that we need to fix the conntrack update path from ctnetlink.

  reply	other threads:[~2017-04-13 23:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 12:53 [PATCH nf V2] netfilter: ctnetlink: make it safer when updating ct->status Liping Zhang
2017-04-13 23:25 ` Pablo Neira Ayuso [this message]
2017-04-14  2:43   ` Liping Zhang

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=20170413232555.GA7517@salvia \
    --to=pablo@netfilter.org \
    --cc=cernekee@chromium.org \
    --cc=fgao@ikuai8.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zlpnobody@163.com \
    --cc=zlpnobody@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 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).