[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071015104306.GA30828@gondor.apana.org.au>
Date: Mon, 15 Oct 2007 18:43:06 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Satoshi OSHIMA <satoshi.oshima.fk@...achi.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Hideo AOKI <hideo.aoki.tk@...achi.com>,
Yumiko SUGITA <yumiko.sugita.yf@...achi.com>,
"青木@RedHat" <haoki@...hat.com>,
Andi Kleen <andi@...stfloor.org>,
Evgeniy Polyakov <johnpol@....mipt.ru>,
Stephen Hemminger <shemminger@...ux-foundation.org>,
吉藤 英明 <yoshfuji@...ux-ipv6.org>
Subject: Re: [PATCH 4/4] UDP memory accounting and limitation(take 5): memory limitation
On Fri, Oct 12, 2007 at 09:11:27PM +0900, Satoshi OSHIMA wrote:
>
> +static inline int __ip_check_max_skb_pages(struct sock *sk, int size)
> +{
> + switch(sk->sk_protocol) {
> + case IPPROTO_UDP:
> + if (sk->sk_prot->sysctl_mem[0] > UDP_MIN_SKB_PAGES)
> + if (atomic_read(sk->sk_prot->memory_allocated)+size
> + >= sk->sk_prot->sysctl_mem[0])
> + return -ENOBUFS;
> + /* Fall through */
> + default:
> + break;
> + }
> + return 0;
> +}
Since you're not doing a per-user limit, you must give each
socket a minimum even when the total exceeds your threshold.
Otherwise any local user can trivially DoS the whole system.
> +UDP variables:
> +
> +udp_mem - INTERGER
> + Number of pages allowed for queueing by all UDP sockets.
> + Minimal value is 4096. If 4096 is set, UDP memory will not
> + be limited.
> + Default: 4096
This seems to be a rather confusing setup. We don't set a
minimum for TCP so is this really necessary?
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists