this post was submitted on 14 Feb 2025
692 points (98.1% liked)

Greentext

5195 readers
1176 users here now

This is a place to share greentexts and witness the confounding life of Anon. If you're new to the Greentext community, think of it as a sort of zoo with Anon as the main attraction.

Be warned:

If you find yourself getting angry (or god forbid, agreeing) with something Anon has said, you might be doing it wrong.

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 57 points 6 days ago* (last edited 6 days ago) (3 children)

In university we were taught C programming. We started with simple things like loops and stuff. After a while the topic processes, threads & stuff came up and of course we were instructed to use that.

In the computer lab there where only thin clients so everything actually ran on the server.

A good friend of mine - not know what was about to happen - entered:

while (true) {
    fork();
}

Astoundingly it took a whole minute until the server froze. ๐Ÿคฃ
That was the same server most of the school stuff ran on. So nearly everything went down. ๐Ÿ˜‚
He got scolded by the sysadmin the next day but nothing serious happened.

[โ€“] [email protected] 58 points 6 days ago (1 children)

I'd scold the sysadmin instead for not cofiguring critical systems in a secure way. Ulimit exists for a reason.

[โ€“] [email protected] 2 points 5 days ago (1 children)

Huh. I never made that connection before. I always thought ulimit was to prevent excessive disk writes or something

[โ€“] [email protected] 2 points 5 days ago

ulimit -H -u 10 will (hard)limit the current process (the shell) to 10 subprocesses. You can also use it to limit the number of open files etc.

To globally configure that for a user/group you'd use /etc/security/limits.conf instead.

If you want to prevent users from filling up the disk, take a look into quota.

[โ€“] [email protected] 8 points 6 days ago (1 children)
[โ€“] [email protected] 19 points 6 days ago

Creates a new process. So, it would create an infinite amount of processes filling RAM.

[โ€“] [email protected] 2 points 5 days ago* (last edited 5 days ago)

:(){ :|:& };:

or (more clearly written):

function forkbomb() {
    forkbomb | forkbomb &  ## background the process whilst recursing
    ## the pipe ensures that both instances are called at the same time, instead of waiting on the other
    ## without the pipe, you just get a linear increase in processes. Slow bomb. We want fast.
};
forkbomb  ## start it all off