Reply to comment

Forked To Hell

Forking programs are quite nice regarding the possibility to create subprocesses for parallel computing or to make good use of Multi-Core- or Multi-CPU-Systems. But you can really shoot yourself in the knee with that!

Really nice is something called a Fork Bomb, which can be implemented very easily with several different languages. The variants shown below can be entered directly on the command line, which makes the no less dangerous. So, please, take care with them:

  • bash
    :(){ :|:& };:
  • perl
    perl -e 'fork while 1'

Both programs don't serve a reasonable purpose except forking and then reloading itself. So the keep forking on and on until the whole system stops working because of the huge number of processes that have been created. So, the Fork Bomb poses a very simple implementation of a denial of service that can only be dealt with by limiting the number of processes per user in /etc/security/limits.conf like that:

@users soft nproc 300
@users hard nproc 400

When the Fork Bomb has be streted without prior precautions, your owned. The system will freeze and don't respond anyomore.

Two hints regarding this issue:

  1. Don't paste every code snippet you got from anyone into your command line if don't know what it does.
  2. If you do it nevertheless, do it on your local client, not on a server that you can reboot only by ssh.

And, no, it wasn't me who gathered experience this way!

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <q> <cite> <blockquote> <code> <ul> <ol> <li> <hr>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <codeblock>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Links to specified hosts will have a rel="nofollow" added to them.

  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.
CAPTCHA
This question shall determine if you're human or machine to prevent automatic SPAM-entries.
Fill in the blank