netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, kuznet@ms2.inr.ac.ru,
	davem@davemloft.net, pekkas@netcore.fi, jmorris@namei.org,
	yoshfuji@linux-ipv6.org, kaber@trash.net
Subject: Re: [PATCH] net: implement emergency route cache rebulds when	gc_elasticity is exceeded
Date: Mon, 29 Sep 2008 23:00:35 +0200	[thread overview]
Message-ID: <48E141F3.9000903@cosmosbay.com> (raw)
In-Reply-To: <20080929202731.GC20074@hmsreliant.think-freely.org>

Neil Horman a écrit :
> On Mon, Sep 29, 2008 at 10:22:03PM +0200, Eric Dumazet wrote:
>> Neil Horman a écrit :
>>> Hey all-
>>> 	We currently have the ability to disable our route cache secret interval
>>> rebuild timer (by setting it to zero), but if we do that its possible for an
>>> attacker (if they guess our route cache hash secret, to fill our system with
>>> routes that all hash to the same bucket, destroying our performance.  This patch
>>> provides a backstop for that issues.  In the event that our rebuild interval is
>>> disabled (or very large), if any hash chain exceeds ip_rt_gc_elasticity, we do
>>> an emergency hash rebuild.  During the hash rebuild we:
>>> 1) warn the user of the emergency
>>> 2) disable the rebuild timer
>>> 3) invalidate the route caches
>>> 4) re-enable the rebuild timer with its old value
>>>
>>> Regards
>>> Neil
>> This sounds not good at all to me.
>>
>> 1) Dont set ip_rt_secret_interval to zero, this is plain silly, since
>>   you give attackers infinite time to break your machine.
>>
>> To quote Herbert (who allowed to set this interval to 0)
>>
>>    "Let me first state that disabling the route cache hash rebuild
>>     should not be done without extensive analysis on the risk profile
>>     and careful deliberation.
>>
>>     However, there are times when this can be done safely or for
>>     testing.  For example, when you have mechanisms for ensuring
>>     that offending parties do not exist in your network."
>>
> Thats really rather the motivation behind this.  The patch that Herbert
> submitted with that commit explicitly lets one disable their rebuild timer.  I
> agree its stupid to do that, but we added code to allow it.  This provides a
> patch to help people who are victimized because they've done exactly this
> (additionaly providing them a warning to stop doing it).

Strange... many kernel parameters can be set to hazardous values that make machine unusable...

ip_rt_gc_interval can also be set to a very large value : No more route cache gc

> 
> 
>> 2) Many machines have ip_rt_gc_elasticity set to 2,
>>   because they have a huge hash table, but low chain depths.
> Ok, that seem reasonable, and this isn't going to disallow that.  By the same
> resoning, people who have huge hash tables, and low chain depths won't
> want their low chain length being violated, would they?  This patch will warn
> them if their assumptions are being violated.

Warn only ? If I read your patch, you not only warn in this case.
(you invalidate cache for each struct net, potentially wraping rt_genid)

When you have 2^20 slots in route cache hash table, you dont care if few slots have 3 or 4 elements.
And chance is very high that more than one slot has 3 or even 4 elements, no need for an attacker.

Now if you change your code to something like

 if (unlikely(chain_length > some_quite_big_number &&
     ip_rt_secret_interval == 0)) {
 	do_something();
 }

some_quite_big_number could be >= 30 or something...

then it might be OK (at least it wont break common setups)




  reply	other threads:[~2008-09-29 21:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29 19:12 [PATCH] net: implement emergency route cache rebulds when gc_elasticity is exceeded Neil Horman
2008-09-29 20:22 ` Eric Dumazet
2008-09-29 20:27   ` Neil Horman
2008-09-29 21:00     ` Eric Dumazet [this message]
2008-09-29 22:38       ` Neil Horman
2008-09-30  6:02         ` Eric Dumazet
2008-09-30 11:23           ` Neil Horman
2008-09-30 14:10           ` David Miller
2008-09-30 17:16             ` Eric Dumazet
2008-09-30 18:42               ` Neil Horman
2008-10-02  7:16                 ` Evgeniy Polyakov
2008-10-02 13:14                   ` Neil Horman
2008-10-01 18:08               ` Neil Horman
2008-10-02  5:01                 ` Bill Fink
2008-10-02  6:56                   ` Eric Dumazet
2008-10-02  8:15                     ` Eric Dumazet
2008-10-02 14:20                       ` Eric Dumazet
2008-10-03  0:31                       ` Neil Horman
2008-10-03 20:36                         ` Neil Horman
2008-10-06 10:49                           ` Eric Dumazet
2008-10-06 13:14                             ` Neil Horman
2008-10-06 20:54                             ` Neil Horman
2008-10-06 21:21                               ` Eric Dumazet
2008-10-06 22:52                                 ` Neil Horman
2008-10-07  5:13                                   ` Eric Dumazet
2008-10-07 10:54                                     ` Neil Horman
2008-10-13 18:26                                     ` Neil Horman
2008-10-16  6:55                                       ` David Miller
2008-10-16  9:19                                         ` Eric Dumazet
2008-10-16 21:18                                           ` David Miller
2008-10-16 11:41                                         ` Neil Horman
2008-10-16 12:25                                           ` Eric Dumazet
2008-10-16 16:36                                             ` Neil Horman
2008-10-16 23:35                                               ` Neil Horman
2008-10-17  4:53                                                 ` Eric Dumazet
2008-10-17  5:23                                                   ` David Miller
2008-10-17  5:03                                                 ` Stephen Hemminger
2008-10-17  5:06                                                 ` Stephen Hemminger
2008-10-17 10:39                                                   ` Neil Horman
     [not found]                                                     ` <48F8806A.6090306@cosmosbay.com>
     [not found]                                                       ` <20081017152328.GB23591@hmsreliant.think-freely.org>
     [not found]                                                         ` <48F8AFBE.5080503@cosmosbay.com>
2008-10-17 20:44                                                           ` Neil Horman
2008-10-18  0:54                                                             ` Neil Horman
2008-10-18  4:36                                                               ` Eric Dumazet
2008-10-18 13:30                                                                 ` Neil Horman
2008-10-20  0:07                                                                 ` Neil Horman
2008-10-20  8:12                                                                   ` Eric Dumazet
2008-10-27 19:28                                                                     ` David Miller
2008-10-02  7:13               ` Evgeniy Polyakov
2008-09-30 14:08   ` David Miller
2008-09-30 14:08 ` David Miller
2008-09-30 17:47   ` Eric Dumazet
2008-10-05  3:26   ` Herbert Xu
2008-10-05  4:45     ` Andrew Dickinson
2008-10-05 17:34       ` David Miller
2008-10-05 18:06         ` Andrew Dickinson
2008-10-06  4:21         ` Herbert Xu
2008-10-06 10:50           ` Neil Horman
2008-10-06 11:02             ` Herbert Xu
2008-10-06 12:43               ` Neil Horman
2008-09-30 14:17 ` Denis V. Lunev
2008-09-30 14:35   ` Neil Horman
2008-09-30 14:49     ` Denis V. Lunev
2008-10-05  3:17 ` Herbert Xu
2008-10-05  3:20   ` Herbert Xu
2008-10-06  0:52     ` Neil Horman

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=48E141F3.9000903@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pekkas@netcore.fi \
    --cc=yoshfuji@linux-ipv6.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).