Linuxfork bomb analysis-LinuxForkBomb

Source: Internet
Author: User

Linuxfork bomb analysis-LinuxForkBomb
Linux Fork Bomb

:() {:| :&};:Is a bash function, known as Fork Bomb, and is a Linux system that is vulnerable to DoS attacks. If you are curious to execute this command, restart the system ~!

Command Parsing
:(){    : | : &};:
:Here is a function name. We define it and execute it later.: | :&,: The function output is transmitted to another colon function as the input through a pipeline and executed in the background.{};It indicates that the content is a function subject.Last one:Is the execution of the evaluate function after the definition is complete. Principle Analysis The first thing to note is::Is a shell built-in command, so the above Code can only generate a fork bomb in bash, because in some other shells, the built-in command has a higher priority than the function, so execute:Always execute built-in commands. (:Is an empty command, while true is equivalent to while:(Commonly used as placeholders) First, let's take a look at the main body of the function.: | :&When using pipelines, two processes start to execute at the same time. Therefore, when you execute:When a function is used, two new processes are generated, and then an original process exits, so that the recursion continues continuously and an infinite recursion is generated. According to this growth model, the growth trend is about 2n . Summary

There are many such traps in Linux, which is exactly why I like Linux and is full of exploration.

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.