Re: [PATCH] netfilter: nf_tables: Implement jump limit for nft_table_validate

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

 



Shaun Brady <brady.1345@xxxxxxxxx> wrote:
> > Furthermore, the largest ruleset I have archived here (iptables-save
> > kubernetes ruleset dump) has 27k jumps (many who are mutually exclusive
> > and user-defined chains that are always terminal), but nf_tables_api.c
> > lacks the ability to detect either of these cases).
> >
> > With the proposed change, the ruleset won't load anymore.
> 
> Much of my testing was omitted from the commit message.  8192 was
> chosen as to what seemed significantly above normal usage; I was way
> off.

8k is brain damaged^W^W very high for nftables thanks to the existence of
verdict maps.  The problem is iptables(-nft) and its linear rules.

> What I did observe was that machines (both big and small) start
> to act up around 16M.  Would it ease minds to simply increase this to
> something like 4M or 8M?

What about going with 64k and NOT applying that limit in the init_netns?

The rationale would be that if you have the priviliges to ramp up the
limitation threshold that limit doesn't exist in practice anyway.

> > Possible solutions to soften the impact/breakage potential:
> > - make the sysctl only affect non-init-net namespaces.
> > - make the sysctl only affect non-init-user-ns owned namespaces.
> 
> I may be misunderstanding how limiting control to (only) non-init-*
> namespaces would help. It certainly would keep a namespace from taking
> the whole system down, but it would leave the original problem of
> being able to create the deadly jump configuration purely in the
> init-net.

Sure, but why do you need to protect init_net?

> Maybe protecting from a namespace is more fruitful than an
> operator making mistakes (the initial revisions intent).

I don't see how you can make such rulesets on accident.

> > - Add the obseved total jump count to the table structure
> > Then, when validating, do not start from 0 but from the sum
> >  of the total jump count of all registered tables in the same family.
> > netdev family will need to be counted unconditionally.
> 
> I had not considered one could spread the problem across multiple
> tables (even if you can't jump between them).  This is a good insight,
> and I will account for this.

Thanks!




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux