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?

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

1 Answer 1

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.

3
  • What kind of limit would that most likely be? Note that I'm acting as root there.
    – helm
    Commented Jun 10, 2015 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
    Commented Jun 10, 2015 at 14:57
  • That file is entirely commented out, so it seems the limit is enforced somewhere else.
    – helm
    Commented Jun 10, 2015 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .