Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 1998 23:31:52 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-security@FreeBSD.ORG, ncb05@uow.edu.au, rotel@indigo.ie
Subject:   Re: preventing fork bombs
Message-ID:  <199807261331.XAA28114@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> #include <unistd.h>
>> 
>> main(void) {
>> 	while(1) {
>> 		fork();
>> 	}
>> }
>> 
>> The above effectively freezing my system. :\
>
>As has been previously observed the system call frequency is so
>high that this is still an effective DOS.  The solution is some
>kind of system call rate limiting.

This has nothing to do with system calls.  It has to do with there
being lots of CPU hog processes.

#include <err.h>
#include <unistd.h>

main()
{
	int nproc;

	nproc = 1;
	for (;;) {
		switch (fork()) {
		case -1:
			warnx("created %d looping processes", nproc);
			for (;;)
				;
		case 0:
			for (;;)
				;
		default:
			nproc++;
			break;
		}
	}
}

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe security" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807261331.XAA28114>