public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] UNIX: Do not loop forever at unix_autobind().
Date: Wed, 01 Sep 2010 21:47:30 +0200	[thread overview]
Message-ID: <1283370450.2484.19.camel@edumazet-laptop> (raw)
In-Reply-To: <201008302227.DJH30258.OQFMFtFJOOVSHL@I-love.SAKURA.ne.jp>

Le lundi 30 août 2010 à 22:27 +0900, Tetsuo Handa a écrit :
> I tried to create and autobind 1048576 UNIX domain sockets using
> http://I-love.SAKURA.ne.jp/tmp/unixloop.asm on 2.6.18-194.11.1.el5.x86_64,
> and found that it needs about 2GB of RAM. Thus, on systems where
> /proc/sys/fs/file-max is larger than 1048576, a local user can create and
> autobind 1048576 UNIX domain sockets in order to let applications fall into
> 
>   while (1)
>   	yield();
> 
> loop. Below is the patch (only compile tested) to avoid falling into this loop.
> Is there any reason a name has to be '\0' + 5 letters?
> Shoud I give up after checking 1048576 names rather than after checking
> 4294967296 names?

Yes please. Fix the bug first.

Then, a following patch to increase current limit, if necessary.

> ----------------------------------------

>  
>  	err = -ENOMEM;
> -	addr = kzalloc(sizeof(*addr) + sizeof(short) + 16, GFP_KERNEL);
> +	addr = kzalloc(sizeof(*addr) + sizeof(short) + 19, GFP_KERNEL);

IMHO, this 16 or 19 value is wrong, we need less memory than that.

(But this will be adressed in a 2nd patch)

Thanks



  reply	other threads:[~2010-09-01 19:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21 12:01 About unix_autobind() Tetsuo Handa
2010-08-21 12:34 ` Changli Gao
2010-08-30 13:27   ` [PATCH] UNIX: Do not loop forever at unix_autobind() Tetsuo Handa
2010-09-01 19:47     ` Eric Dumazet [this message]
2010-09-04  6:58       ` Tetsuo Handa
2010-09-04  7:11         ` Eric Dumazet
2010-09-04  7:40           ` Tetsuo Handa
2010-09-04  8:24             ` Eric Dumazet
2010-09-04  9:31               ` Tetsuo Handa
2010-09-04 10:55                 ` Eric Dumazet
2010-09-04 11:34                   ` Tetsuo Handa
2010-09-07  1:45                     ` David Miller
2010-09-04 11:52           ` Michał Mirosław
2010-09-01 21:33     ` How can OOM killer detect process consuming much kernel memory? Tetsuo Handa
2010-09-01 22:25       ` David Rientjes
2010-09-03  6:32       ` KOSAKI Motohiro

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=1283370450.2484.19.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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