1

I'm running a RHEL 6.5 VM in a VMware ESXi environment and accessing it through the vSphere Web Client virtual console (in my browser).

I wanted to crash this machine on purpose and executed

:(){ :|:& };:

However, all I get is

bash: fork: Cannot allocate memory

a couple of times and then it stops from doing anything. I can easily exit via Ctrl+C and continue working normally. What could be the reason this fork bomb does not work?

helm
  • 121

1 Answers1

2

More modern OSes protect themselves from this sort of misuse by default, usually by setting user limits. That's probably why the system is still responsive - it only lets you allocate memory up to a certain amount, which is much less than the machine has available.

John
  • 17,011
  • What kind of limit would that most likely be? Note that I'm acting as root there. – helm Jun 10 '15 at 14:50
  • 1
    Look in /etc/security/limits.conf - I would guess it's some sort of process (nproc) or memory limit. Just because you're running as root doesn't mean the system isn't trying to protect itself against you fork-bombing it. – John Jun 10 '15 at 14:57
  • That file is entirely commented out, so it seems the limit is enforced somewhere else. – helm Jun 10 '15 at 15:21