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?

  • What is the expected behavior? – Mark Plotnick Jun 10 '15 at 14:57
  • Extreme lags leading to an unresponsive system, where the only option to go back to normal is to reboot. – helm Jun 10 '15 at 14:59
  • what is the limit on the number of processes that user can run? (ulimit -u) – Mark Plotnick Jun 10 '15 at 15:11
  • Output is 62788 – helm Jun 10 '15 at 15:16
  • RHEL 6: max user processes is set to 1024 for root and non root. – Cyrus Jun 10 '15 at 21:55
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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.