visit Haymarket Interactive  Atomic  |  PC Authority  |  CRN Australia  |  iTNews  |  PC Authority Business Centre  |  SC Magazine | careers  
Home
Thursday, 9 September 2010
04:54:30 PM
Users online: 0   You are here >> Home > Programming
LOGIN PASSWORD   forgot my details
Programming and development
For hobbyists, professionals, and the curious
Forums | Programming Forums search
Forum FAQ
   
  1  
fork bombs. Are they written in C, C++ or assembly? Or are they portable?
Oneiga shimasu 
8/5/05 06:17:56 PM
Guru

I always thought they were made in C, but when I think about it, couldn't it go either way?

-----
http://www.the-endless-abode.dhs.org

67.25838%- Geek god - Registered Linux user #376313.

#include "atomic.h"

ni 
8/5/05 06:33:45 PM
Hero
Guru


You're confused.

The term "fork" refers to a UNIX/POSIX system call, that causes a process to get an exact copy of itself, the only difference being the return value from each process' fork call (the child fork gets a 0, and the parent fork gets the pid (process id) of the child).

Also, since assembly language is simply a set of mnemonics that translate into binary machine code instructions, and C is simply a higher level language that a compiler will translate also into binary machine code instructions, then obviously anything you can do in C, you can do in assembly language. All unix systems have machine code to call system calls such as fork.

Technically, you can't really write a fork bomb in pure ANSI/ISO standard C, since fork is a function implemented by UNIX/POSIX systems, and is not part of the C standard library. However, since all POSIX (and other unix standards) systems will have the fork system call, you can implement a fork bomb in C, C++, and any other language that allows you to call standard system calls (examples include Perl, Python, etc.)

A fork bomb is a (usually) very simply program that calls fork() over and over again. This can of course be done in any language that can call fork.

-----
Build a man a fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life.

Oneiga shimasu 
8/5/05 07:28:26 PM
Guru

Ah, I get it now. Thanks for explaining it to me.

-----
http://www.the-endless-abode.dhs.org

67.25838%- Geek god - Registered Linux user #376313.

#include "atomic.h"

pappes 
8/5/05 09:35:49 PM
Master

It should be noted that deploying a fork bomb on any equiptment for which you do not have permission to deploy a fork bomb, or encouraging anyone else to do so would be illegal.

-----
I am a genious, what's your excuse?

The above post is made available under the terms of GPL. Any reproduction of this post is subject to the GNU General Public License

stadl 
8/5/05 11:49:14 PM
Hero
Guru


Quote by pappes
It should be noted that deploying a fork bomb on any equiptment for which you do not have permission to deploy a fork bomb, or encouraging anyone else to do so would be illegal.



True, but then any posix sys admin that doesn't run process quotas for users to avoid the impact of fork bombs to some degree deserves what they get - same if they run an OS without process quota support :).

At uni, they had the mini computer killed about a dozen times in 2-3 days by students accidentally (and perhaps one or two deliberately) writing fork bombs. When they realised the source, a simple 30 or so processes per user quota was installed which was plenty for useful work, and saved the machine from falling over.

We were doing assignments learning about forking processes, and it's always possible for people to F***k up the loop and return value checking, so that you could suddenly fire off 1000+ processes

-----
...so brilliant in fact, that by simply harnessing the power of one live frog, it.. it.. uhh.<poke> <poke>
World domination has encountered a momentary setback. Talk amongst yourselves.

Waffles, Lots of Waffles... And Chips...

MastaC 
9/5/05 12:09:47 AM
Overlord

Also... People are not encouraged to actually create fork bombs - The shrapnel would be devastating. har ..har

-----
Borat: We say in Kazakhstan, "You find me woman with brain, I find you a horse with...Wings."

Slace 
9/5/05 11:34:30 AM
Champion

they can be done by accident easy, this was from one of the uni servers when we had to write our own shell: http://slace.sytes.net:65/pics/top.JPG


Edited by Slace: 9/5/2005 11:34:42 AM

-----

$ cd /pub
$ more beer

zephyr 
9/5/05 11:48:39 AM
Hero
Guru


Quote by Slace
they can be done by accident easy, this was from one of the uni servers when we had to write our own shell: http://slace.sytes.net:65/pics/top.JPG


Edited by Slace: 9/5/2005 11:34:42 AM




hahaha... i guess it would suck to be the user "wmchi" about then :D

-----
"It is better to be silent, and be thought a fool, than to speak and remove all doubt." (Confuscius)

Slace 
9/5/05 05:13:32 PM
Champion

it sucked to be anyone, for some odd reason the server was really slow :P

-----

$ cd /pub
$ more beer

Mister_T 
11/5/05 09:25:58 AM
Titan

/sings tom jones style

fork bomb, fork bomb,
your my fork bomb.
and baby you can... cripply my PC?

t

-----
http://frase.homeip.net

ricee007 
12/5/05 12:05:12 PM
Overlord

it can be written in JS too...i mean, its justopening a new window, again and again...

R

-----
hmph.

2.6C, 1GB kingston ddr400, G4 440MXSE, GA 8 IPE1000PRO 2

Quote by Peter Pan



"Let's have freaky fun with RC-powered dildos!!!111"
ni 
12/5/05 12:11:11 PM
Hero
Guru


Quote by ricee007
it can be written in JS too...i mean, its justopening a new window, again and again...

Opening a new window again and again isn't a fork bomb. It doesn't cause any processes to fork, unless the browser implements javascript/window management in a spectacularly stupid way.

-----
Build a man a fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life.

Slace 
12/5/05 01:11:56 PM
Champion

i've got a great program to cripple your ram. its just some bad/ lazy programming. it was a paint-style program that has a dodgy undo. just pushes the image onto a stack and never removes them. push on enough images and you'll run out of ram ;)

-----

$ cd /pub
$ more beer

  1  
Forums | Programming