crash () { crash|crash& }; crash
Sorry I know this would bring the server to its knees if ulimit is not set. However, can someone explain to me why this works.
crash () { crash|crash& }; crash But either of the following doesn't? This should recursively calls the function "crash". crash () { crash }; crash This should recursively calls the function "crash", except to throw it into the background. crash () { crash& }; crash |
Hello,
At the following links you'll find all information and explanation about Bash fork bombs you might need: http://www.cyberciti.biz/faq/underst...ash-fork-bomb/ http://en.wikipedia.org/wiki/Fork_bomb Kind regards, Eric |
Can you tell me why the following wouldn't work? It's still calling itself recursively and putting the child processes into background.
crash () { crash& }; crash Also, not sure why the following would regain the process table slots as per http://en.wikipedia.org/wiki/Fork_bomb while (sleep 100 &!) do; done What is the ! doing? Assuming it's the same as the following, it still is taking back one process slot. And this isn't being released back to the system for an admin to run any commands to kill the bomb. while (true) do; done |
I'm lost.
What are you trying to do? Create a fork bomb, prevent a fork bomb, or just understand the makings of a fork bomb? The reason I'm asking is that I dunno if it would be kosher to assist you with creating a fork bomb. Preventing one might be doable, along with helping one comprehend. But this applies to zsh but it may well apply to bash also: Quote:
Then the post after it: Quote:
|
Hi,
This crash () { crash& }; crash does "work". Its just not fast enough to do any real harm. Open 2 terminals, start top in one and the following in the other: crash () { sleep 1 ; crash& }; crash You'll see the sleep command and a bash session that change pid every 1 second and this will go on forever. Without the sleep 1 it will run for a short while before it is killed by the system. It is just not fast enough. The original command multiplies very fast (1, 2, 4, 8, 16 etc.) and overwhelms the system if no precautions are taken. Hope this clears things up. |
druuna, thanks. I get what you say.
|
You're welcome :)
|
All times are GMT -5. The time now is 03:03 AM. |