Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Linux destroyer

This thread is locked; no one can reply to it. rss feed Print
Linux destroyer
enric
Member #4,016
November 2003
avatar

Hi,
I am learning about linux-programming and wrote this prog:

int main(){ while(1) {fork()} }

I thought it would be fun. At first it was: I ran it as a normal user, tryed to start a program, and it said "out of pids", then somehow the gterm which ran it crashed, and I wasn't able to do a killall or a shutdown or a "su" because I was out of pids :P Basically I did a ctrl-alt-del and it didn't work either so I had to reset:

:P :P !
The ext3 system partition was broken and unreparable => Reinstall. Luckyly I have a separate partition for /home so I am up and running now (didn't loose data).

So my question: a simple user can render a computer unusable? with such a simple prog? Why is so. Shouldn't users have a limited number of pids?

I admit I was a bit disappointed by this "security hole"

SUSE 9.0 btw.

______________________________________________________
My websites: Trufoli Games, Personal

BAF
Member #2,981
December 2002
avatar

you can use PAM or even just simple security file (someplace in /etc) to limit the amount of pids one user can run. Most production servers do this.

Rash
Member #2,374
May 2002
avatar

Have you tried ReiserFS or XFS as file system instead?

And this doesn't belong in this forum.

ReyBrujo
Moderator
January 2001
avatar

Indeed.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

BAF
Member #2,981
December 2002
avatar

XFS sucks, that is even less tolerant to abrupt shutdowns.

ReyBrujo
Moderator
January 2001
avatar

Quote:

The ext3 system partition was broken and unreparable

Sure? I remember when I once ran a recursive program that created directories inside directories and the hard disk went mad. I had to reboot, enter as single user (the system forced me into single user mode, rather), and run fcdsk (I think, Redhat 7). That fixed all the lost inodes and after rebooting I could delete the bunch of directories and continue working.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Evert
Member #794
November 2000
avatar

Quote:

and I wasn't able to do a killall or a shutdown or a "su" because I was out of pids

Switch to a different vterm, login as root and kill the user processes?
At least I'd hope the system keeps some PIDs reserved for root...

Chris Katko
Member #1,881
January 2002
avatar

Quote:

I thought it would be fun. At first it was: I ran it as a normal user, tryed to start a program, and it said "out of pids", then somehow the gterm which ran it crashed, and I wasn't able to do a killall or a shutdown or a "su" because I was out of pids :P Basically I did a ctrl-alt-del and it didn't work
either so I had to reset:

How'd a user-level program destroy the computer? What happened to this "linux security" thing?

Quote:

The ext3 system partition was broken and unreparable => Reinstall. Luckyly I have a separate partition for /home so I am up and running now (didn't loose data).

o_O

How did a program destroy your partition? It shouldn't be able to harm it.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

BAF
Member #2,981
December 2002
avatar

ctrl+alt+del killed it. It can happen any place. It is journaled, a bad jorunal or corruption caused by an abrupt shutdown, or shutdown with data still in the HD cache can cause that stuff.

Chris Katko
Member #1,881
January 2002
avatar

But... wasn't that the point of having a journalling (sp?) file system? I guess it's no NTFS, eh? ;)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Billybob
Member #3,136
January 2003

enric: I agree it's odd that there is no default PID limits. As said you can put one in, and you should. It's listed in the Gentoo security guide, BTW. Which is a semi-good read even if you don't use Gentoo.
Why there is no default limit is beyond me though. What normal user would be running over, say, 1000 processes?

Thomas Fjellstrom
Member #476
June 2000
avatar

Odd, I've had some nasty crashes in linux, and not once was it not able to boot (since I started using ext3). And untill just recently it was set to not run a check on startup (stupid mistake, it caused some odd errors, as if you dont run the check, the journal isn't applied.)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

HoHo
Member #4,534
April 2004
avatar

I've user ReiserFS and had some crashes(couple tests with a bit too unstable machine and some driver problems) but I've never destroyed or harmed the file system.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Avenger
Member #4,550
April 2004

razor
Member #2,256
April 2002
avatar

Is ext3 that unstable? I've killed mine using the power switch a number of times without a problem (of course it has to run it's nice check at the beginning). This is both on gentoo and mandrake.

Whoooo Oregon State University

Evert
Member #794
November 2000
avatar

Ext3 should be fine, normally. I've had some severe crashes and never had a problem with the filesystem. Then again, I barely have ever had problems with FAT in DOS and Windows either.

Crazy Photon
Member #2,588
July 2002
avatar

Sometimes I experienced lost files on ext3 when my system crashed, actually I once lost some init script, so I had to reinstall... With ReiserFS things were much better in that sense, altough performance goes down... I am trying XFS now to see how it is, altough I had no crashes yet...

-----
Resistance is NEVER futile...

razor
Member #2,256
April 2002
avatar

Quote:

Ext3 should be fine, normally. I've had some severe crashes and never had a problem with the filesystem. Then again, I barely have ever had problems with FAT in DOS and Windows either.

The only problem I've ever had with windows (NTFS) was when my ram went bad and some seriously screwed files were copied back to the drive from ram. Then scandisk tried to fix everything and froze. Needless to say everthing was screwed from there.

Whoooo Oregon State University

Arthur Kalliokoski
Second in Command
February 2005
avatar

I've been running linux on ext2 through reiserfs since '97 and never had the filesystem mess up (although that's partly because it never crashes unless I do something truly stupid like a fork bomb "just to see what happens". OTOH, Windows messes up so often (dual boot) that I have the procedure to save & restore windows partitions to a linux dir down cold.

BSOD as per usual, hardware reset necessary
On booting windows "To avoid seeing this error always shut down from start menu" implies it's MY fault, stick more pins in the bill troll.
windows scandisk turns everything into a CHK file
reboot, tell grub to boot linux.
dd bs=512 count=20000 if=/dev/zero of=/dev/hda1 (then hda2 if D: munged)
run the windows install cd
use linux install disk rescue option to dd bs=512 count=1 if=grubimage of=/dev/hda to repair windows rewrite of MBR.
cd /winbak2384/C
cp -r --preserve=timestamps allegro /windows/C
rinse lather repeat...

They all watch too much MSNBC... they get ideas.

Archon
Member #4,195
January 2004
avatar

Quote:

implies it's MY fault, stick more pins in the bill troll.

Troll? If you said doll, it'd make more sense... How many people have a voodoo dool of Bill Gates and stabs the doll when Windows messes up?

Arthur Kalliokoski
Second in Command
February 2005
avatar

to me, "doll" implies something attractive... (Hey doll!)

They all watch too much MSNBC... they get ideas.

BAF
Member #2,981
December 2002
avatar

you are using win98? eeeew :P

Arthur Kalliokoski
Second in Command
February 2005
avatar

I like real live DOS! I still have a "I (heart) DOS" bumper sticker which nobody understands anymore.:D

They all watch too much MSNBC... they get ideas.

Archon
Member #4,195
January 2004
avatar

Quote:

"I (heart) DOS" bumper sticker which nobody understands anymore.:D

Isn't the acronym for DOS being converted to the common term for Denial of Service?

jhuuskon
Member #302
April 2000
avatar

No, that's DoS. ;)

You don't deserve my sig.

Go to: