Recently I've been digging up information about processes in GNU/Linux and I met the infamous fork bomb :
:(){ : | :& }; :
Theoretically, it is supposed to duplicate itself infinitely until the system runs out of resources...
However, I've tried testing both on a CLI Debian and a GUI Mint distro, and it doesn't seem to impact much the system. Yes there are tons of processes that are created, and after a while I read in console messages like :
bash: fork: Resource temporarily unavailable
bash: fork: retry: No child processes
But after some time, all the processes just get killed and everything goes back to normal. I've read that the ulimit set a maximum amount of process per user, but I can't seem to be able to raise it really far.
What are the system protections against a fork-bomb? Why doesn't it replicate itself until everything freezes or at least lags a lot? Is there a way to really crash a system with a fork bomb?
:(){ :& :; }; :
instead? Do they also all end up getting killed eventually? What about:(){ while :& do :& done; }; :
?ulimit -u unlimited
would be the command line method to setmax user processes
tounlimited
however that would be overridden i believe by thehard
limit in/etc/security/limits.conf
/etc/security/limits.conf
and set both the hard and soft limits tounlimited
fornproc
I believe that would undo the protection mechanism and allow your fork bomb to blow up (i.e. really crash) your system.