Fork Bomb and why it doesn't happen on BSDs

Ow Mun Heng Ow.Mun.Heng at wdc.com
Fri Mar 25 03:54:31 UTC 2005


On Fri, 2005-03-25 at 10:28 +0800, Ow Mun Heng wrote:
> On Thu, 2005-03-24 at 14:11 -0600, Aleksandar Milivojevic wrote:
> > William Hooper wrote:
> > > Ow Mun Heng said:
> > > [snip]
> > > 
> > >>The author then compares the results with that of BSD eg: OpenBSD and
> > >>FreeBSD IIRC, and notes that on a system with Pentium 90 w/ 32MB Ram, on
> > >>using the forkbomb, doesn't bring the system down to it's knees.
> > > 
> > > 
> > > Following the discussion on the -devel list, the BSDs aren't immune.
> > > 
> > > https://www.redhat.com/archives/fedora-devel-list/2005-March/msg01201.html
> > 
> > I gave a try to "while(1) fork();" on OpenBSD (SS5, 64MB RAM).  You 
> > can't go much simpler than that.  Results:
> > 
> > Running as normal user, max number of processes is limited to 64 by 
> > default, load average went to 50-something.  Perfectly able to kill 
> > offending process(es).
> > 
> > Running as root, max number of processes is limited to 340, load average 
> > went to almost 300.  Not able to do much, since root couldn't create any 
> > new processes (in order to kill existing), but top worked, and already 
> > running processes worked.  Anyhow, if somebody does fork bomb as root, 
> > he could just as well type "halt" or wipe out the disk or do some other 
> > irreversable damage.
> > 
> > The maximum number of processes per user is hard coded in OpenBSD 
> > kernel.  It is 340 for root, and 64/128 for normal users in my generic 
> > kernel (soft limit is 64, hard limit is 128).  If you want more either 
> > for root or normal users, you need to recompile the kernel.  In *BSD 
> > world, recompiling the kernel is something you do twice a day anyhow, so 
> > this isn't much of a problem ;-)
> > 
> > For those interested, these are ulimits on stock OpenBSD (user and root, 
> > soft and hard).
> > 
> [SNIP]
> 
> I see.. So, ulimits _are_ set by default(lower) in *BSDs and not as what
> I thought that they had some kind of process watchdog in place.
> 

One more thing, what about if there are 20 users and all the 20 users
try to fork at the same time? What will happen then?

> 

-- 
Ow Mun Heng
Gentoo/Linux on DELL D600 1.4Ghz 
98% Microsoft(tm) Free!! 
Neuromancer 11:54:04 up 1 day, 2:31, 5 users, load average: 0.91, 0.61,
0.55 





More information about the fedora-list mailing list