How do you make your UNIX crash ???
Jamie Mason
jmason at gpu.utcs.utoronto.ca
Wed Mar 13 15:30:21 AEST 1991
In article <589 at spool.mu.edu> gill at boris.mscs.mu.edu (VAXDEATH (Ender) Gill) writes:
>
>main()
>{
> fork ();
> main ();
>}
>
>This brought the system crashing to a halt, before they set up a quota
>for process. The system was a SysV 3.0, on 3B5.
Isn't C syntax fun?
main() { while (1) fork(); }
These only destroy the machine if you do not have a per-user
process limit. If you do, you just bring YOURSELF to a grinding halt.
> Also, running two copies of Franz Lisp simultaneously would cause
>the system to crash. This bug has since been fixed.
Well we have PCL (Commoin Lisp) at our faciltiy. No bug, but
each process apparently allocates itself FIVE MEGABYTES of memory. When
the Lisp class has an assignment due... Well guess what it does to the
memory swapper?!? It does not CRASH the system, but drives it into the
dirt.
Might I suggest a nicer way to abuse your Unix? This works even
if there is a per-user process limit...
#define BIGNUM 128*1024*1024
#define PAGESIZE 4*1024
char eatmem[BIGNUM];
main()
{
for (i=0 ; i += PAGESIZE ; i < BIGNUM) ++eatmem[i];
}
Define BIGNUM to be a REAL large amount of memory that your
system will allow you to have in your DATASIZE limit. Alternately, you
could MALLOC the memory instead of making it static, subject to your
MEMORYUSE limit.
Define PAGESIZE to be the size of the memory page the swapper
pages in on your system.
Now comes the fun part:
foo.bar% cc thrash.c
foo.bar% a.out
This cute little program will allocate a HUGE amount of memory,
then read it in a way which makes the swapper do a page-in for *EVERY
ACCESS*!! This slows the system down to a *TOTAL* crawl... Almost
a crash.
Of course you could write a program which simply malloc()s 512k,
then another 512k, and another... (Assuming you do not have per-usre
limits on 'memoryuse') Until you run out of swap space...
PANIC: out of swap space
<CRASH!>
Kids, *DO NOT TRY THIS AT HOME*!! Seriously, a cute little
program can do *REAL* nasty things to your favourite UNIX box... Don't
do in on any machine on which you plan on keeping your account :-)
Jamie ... "Who was that Masked Interrupt?"
Written On Wednesday, March 13, 1991 at 12:23:27am EST
More information about the Comp.unix.admin
mailing list