Re: forkbombing Linux distributions

Jan Engelhardt
2005-03-21T07:41:31Z

>>William> Sure enough, I created the following script and ran it as a
>>William> non-root user:
>>
>>William> #!/bin/bash $0 & $0 &
>>
>>There are two approaches to fixing this.
>> 1. Rate limit fork()
>> 2. Limit (per user) the number of processes allowed
>
>Had to try it out of curiosity, five ssh logins at the time,
>but I hit Ctrl-S on the terminal running forkbomb, then other
>terminals responsive and I could recover, do 'killall forkbomb'.

By the time you killed a handful of procs, the other half spawned new ones.

You can try stopping forkbombs by "killall -STOP nameofprog" and then
"killall -9 nameofprog".

But you probably won't get to run killall in case of a thrasher running within
the limits of `ulimit -m` and `ulimit -u`:
perl -e 'fork,$_="x"x 10E6 while 1'

Jan Engelhardt
--