From: Florian Westphal <fw@strlen.de>
To: Andrey Wagin <avagin@gmail.com>
Cc: netfilter-devel@vger.kernel.org,
Patrick McHardy <kaber@trash.net>,
Pablo Neira Ayuso <pablo@netfilter.org>,
vvs@openvz.org, Cyrill Gorcunov <gorcunov@openvz.org>,
Florian Westphal <fw@strlen.de>
Subject: Re: A conntrack, which is added via ctnetlink, can provoke a race condition
Date: Tue, 7 Jan 2014 13:32:00 +0100 [thread overview]
Message-ID: <20140107123200.GE9894@breakpoint.cc> (raw)
In-Reply-To: <CANaxB-wntm+Vu5z0k9bRYLvPX3ezFZSEQkGPGH3AVYDT5DrOKw@mail.gmail.com>
Andrey Wagin <avagin@gmail.com> wrote:
> When a conntrack is created by kernel, it is initialized (sets
> IPS_{DST,SRC}_NAT_DONE_BIT bits in nf_nat_setup_info) and only then it
> is added in hashes (__nf_conntrack_hash_insert), so one conntract
> can't be initialized from a few threads concurrently.
>
> ctnetlink can add an uninitialized conntrack (w/o
> IPS_{DST,SRC}_NAT_DONE_BIT) in hashes, then a few threads can look up
> this conntrack and start initialize it concurrently. It's dangerous,
> because BUG can be triggered from nf_nat_setup_info.
Good catch.
I don't see a good solution at the moment.
We can force null bindings if no nat transformation is specified
from userspace. But this would mean that rules specified in the nat
table are not evaluated anymore when the first packet arrives.
The only other solution is see is full serialization
via ct->lock.
next prev parent reply other threads:[~2014-01-07 12:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 9:40 A conntrack, which is added via ctnetlink, can provoke a race condition Andrey Wagin
2014-01-07 12:32 ` Florian Westphal [this message]
2014-02-02 23:41 ` 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=20140107123200.GE9894@breakpoint.cc \
--to=fw@strlen.de \
--cc=avagin@gmail.com \
--cc=gorcunov@openvz.org \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=vvs@openvz.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).