Re: A conntrack, which is added via ctnetlink, can provoke a race condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 07, 2014 at 01:32:00PM +0100, Florian Westphal wrote:
> Andrey Wagin <avagin@xxxxxxxxx> 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.

conntracks that are added via ctnetlink should already include the nat
information (if any) at creation time, this is how it works with
state-sync via conntrackd when nat is present. I think attaching the
null binding seems like the easier solution to me.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux