Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: jsjdb@acad1.alaska.edu (Jason D. Bourgoin)
Subject: Preventing/terminating runaway user fork() anyone?
Date: Thu, 7 Jul 1994 23:28:00 GMT	[thread overview]
Message-ID: <7JUL199414283003@acad1.alaska.edu> (raw)

My sysadmin of our DEC Alpha 3000/300, running DEC OSF/1 V2.0 (Rev.
240), asked me to post here, so I apologize in advance if this is a 
FAQ, or if this isn't an appropriate newsgroup to post this to.  I'm
crossposting this in attempt to receive many more productive responses
than I might otherwise by posting to a single group.

Please address any followups to me as electronic mail, as a busy work
schedule (read: a Real Life) occassionally interfere with my abilty to
keep constant watch on the x000 newsgroups propagated around the world.

Before I continue, the system has 32 megs of RAM, 150Mhz 64-bit Alpha
processor, and roughly 500 megs of hard disk (not that this should be
a concern).

I've been given the (sometimes) dubious task of probing system security
and weaknesses on it, so I compiled and ran the following short C program
(it's admittedly not fancy, but it served my purpose).  Yes, I was aware
of how fork() works, so keep reading before opting to followup telling me
to "man fork," and yes, I've already run COPS, Crack, TAMU, and just about
every off-the-shelf public domain/freeware system security package out there.
Now, I wanted to test weaknesses that aren't necessarily security holes, but
might be situations to correct if possible.

main()
{

	while(1)
		fork();
}

I was expecting it to fork off duplicating processes no problem but 
was primarily testing to see if the system would max out processes all
together, or whether the system would set a ceiling on processes from 
the individual userid that initiated it, as well as prevent further
forking beyond that ceiling limit.

Immediately, the login I initiated the program from locked up (I didn't
run it as a background process, nor did I want to for this test), so I
had to ^] to drop to the TELNET> prompt on our cozy VAX/VMS system.  Then,
I started another telnet session and hopped back up to the Alpha, which
accepted my login, but told me "No more processes."  Every command after
that, except "cd" and "logout," returned that same response.  

I figured that I'd either maxed out my individual userid's process limit
(if there was such an animal) or maxed out the system, so I thought it a 
good time to speed dial the sysadmin and let him know what was up.  Damn,
I really hate dealing with voicemail, so I decided to call him back later.

He called me about 10 minutes later asking what I was doing to bog down the
system, so I recapped what I was toying with.  So, now that we'd pretty much
established that the system *itself* was peaked out to its maximum process
limit, and not merely just my user account on the system, we dropped back to
single-user mode for a reboot from the console.

Now, that's the "quick-and-dirty" way of fixing it, but we'd really like to
(a) be able to limit the number of processes an interactive user, anything
run by the user, and any child processes are able to spawn off, and (b) in
the event of another runaway duplicating fork, be able to track down and kill
off all of the processes spawned from the original program, without having to
kill off all of the processes on the system like shutdown typically does.

I realize that request (b) can be accomplished with shell scripts to locate
the PID's of the offending programs and therefore terminate them with extreme
prejudice, but has anyone a solution to limiting the number of processes an
individual user process can generate, as well as the number of child/forked
processes, even if they are forked from another fork?

Any comments, other than RTFM, will be greatly appreciated.  

Thanks in advance

-- 
Jason D. Bourgoin  c/o  University of Alaska Southeast, Computer Center
11120 Glacier Highway, Juneau, Alaska  99801, ( 9 0 7 ) 4 6 5 - 6 5 2 1
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Personal (or anything not work-related) e-mail:  jsjdb@acad1.alaska.edu
UAS Computer Center (official business) e-mail:  jxjdb@acad1.alaska.edu



                 reply	other threads:[~1994-07-07 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox