So, it uses the fact that bash allows functions with non-alphanumeric names, in this case it defines a function called :. If we rename that to, for example bomb it becomes a little clearer:
bomb(){ bomb | bomb& };bomb
This defines a function that calls itself piped into a version of itself in a separate, background, process (that's what the & does) and then calls that function. Calling itself means the function never ends (it's essentially a recursive version of an infinite loop) and the extra background process that is created each time it's called means that it just keeps exponentially creating new processes that don't exit and each of which infinitely forks off more processes until the OS runs out of resources (unless you use ulimit to set per-session/per-user process limits - this may even be done by default on some distros these days, it's been a while since I looked)
Thank you, this is the first time I've ever actually seen the fork bomb described in a way that makes sense. I knew what it did but I didn't understand how the input string caused it, it was effectively just a magic rune of crashing to me. This is a great explanation.
People do it as a stress test of their system. A goodly OS should be able to stop it before it crashes the system, otherwise it won't cause much damage (depends on what else you're doing when it crashes)
All my computer is for is drawing pictures, making noise and occasionally doing internet stuff that's too obnoxious to do from my phone. I don't game or code or torrent. Really mostly just Blender and PrusaSlicer.
In easier terms: it's a script function, which when executed starts itself twice (recursion), leading to an infinite loop that takes up resources, and - in the worst case - causes a freeze or crash. Due to its cryptic code, an unknowing user might not know what they get themselves into when they run it.
22 Comments
atropa@piefed.social · 49 pts · 132d
Pat_Riot@lemmy.today · 22 pts · 132d
Can you explain for us casuals?
gnutrino@programming.dev · 54 pts · 132d
So, it uses the fact that bash allows functions with non-alphanumeric names, in this case it defines a function called
:. If we rename that to, for examplebombit becomes a little clearer:bomb(){ bomb | bomb& };bombThis defines a function that calls itself piped into a version of itself in a separate, background, process (that's what the
&does) and then calls that function. Calling itself means the function never ends (it's essentially a recursive version of an infinite loop) and the extra background process that is created each time it's called means that it just keeps exponentially creating new processes that don't exit and each of which infinitely forks off more processes until the OS runs out of resources (unless you useulimitto set per-session/per-user process limits - this may even be done by default on some distros these days, it's been a while since I looked)skulblaka@sh.itjust.works · 30 pts · 132d
Thank you, this is the first time I've ever actually seen the fork bomb described in a way that makes sense. I knew what it did but I didn't understand how the input string caused it, it was effectively just a magic rune of crashing to me. This is a great explanation.
Pat_Riot@lemmy.today · 3 pts · 132d
So does it actually hurt anything?
snoons@lemmy.ca · 10 pts · 132d
It might freeze up your computer.
Holytimes@sh.itjust.works · 2 pts · 130d
Worse case you just gotta reboot your PC.
atropa@piefed.social · 27 pts · 132d
Pat_Riot@lemmy.today · 8 pts · 132d
Sounds awful. Since I switched to Mint my computer has only crashed when I got out of hand with Blender, I can't see myself doing it on purpose.
ozymandias@sh.itjust.works · 11 pts · 132d
People do it as a stress test of their system. A goodly OS should be able to stop it before it crashes the system, otherwise it won't cause much damage (depends on what else you're doing when it crashes)
atropa@piefed.social · 5 pts · 132d
RamenJunkie@midwest.social · 7 pts · 132d
When I switched to Mint mine just started smelling nicer.
atropa@piefed.social · 5 pts · 132d
atropa@piefed.social · 4 pts · 132d
Pat_Riot@lemmy.today · 2 pts · 132d
All my computer is for is drawing pictures, making noise and occasionally doing internet stuff that's too obnoxious to do from my phone. I don't game or code or torrent. Really mostly just Blender and PrusaSlicer.
AzuraTheSpellkissed@lemmy.blahaj.zone · 3 pts · 132d
In easier terms: it's a script function, which when executed starts itself twice (recursion), leading to an infinite loop that takes up resources, and - in the worst case - causes a freeze or crash. Due to its cryptic code, an unknowing user might not know what they get themselves into when they run it.
niartenyaw@midwest.social · 2 pts · 132d
it creates a process that makes copies of itself. then those copies make copies... until your computer runs out of resources and crashes
Pat_Riot@lemmy.today · 1 pts · 132d
Ick.
celeste@feddit.org · 17 pts · 132d
Xenia my beloved
JackbyDev@programming.dev · 7 pts · 132d
Xenia 🥰 happy to see more of her.
JackbyDev@programming.dev · 11 pts · 132d
Little Bobby Fork Bomb
ElectroLisa@piefed.blahaj.zone · 10 pts · 132d
I need this mug
wolfrasin@lemmy.today · 9 pts · 132d
Gets me with the Bobby tables xkcd https://imgs.xkcd.com/comics/exploits_of_a_mom_2x.png
snoons@lemmy.ca · 1 pts · 132d
Cute lil' Bobby Tables.
mastod0n@lemmy.world · 7 pts · 132d
Is this digital Mitosis?
SAF77@lemmy.world · 14 pts · 132d
More like cancer. Replication till death.
Draconic_NEO@pawb.social · 4 pts · 131d
Ah Xenia, very often up to no good it seems.
Cevilia@lemmy.blahaj.zone · 4 pts · 131d