A fork bomb from the Linux shell

Source: Internet
Author: User
. (){ .|.  &};. Or:() {:|:&};:

These 13 characters by Jaromil, in 2002 designed the most streamlined implementation of a fork bomb.

. () Note the following to define a function, the function name is a decimal point, no optional parameters;
{denotes the beginning of the function body;
.|. & represents what the function body really wants to do, first it recursively uses this function, and then Li Yonggui the pipeline to invoke a new process (the thing it does is to call this function recursively) and put it in the background.
} Indicates the end of the function body;
; Does not perform any operations that are used to separate two commands from the command line. Overall, it shows that the program consists of two parts, first defining a function, and then invoking the function;
. Represents the call to this function.

This recursive function can call itself, constantly generate new processes, resulting in a denial of service attack, the function called the former & the child process into the background. This dangerous code will branch out a lot of processes and is called a fork bomb.

You can avoid this bomb by modifying the configuration file/etc/security/limits.conf to limit the maximum number of processes that can be generated.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.