Advertisement

Killing a Mac OS X machine

My buddy Robert Citek has been interested, over the last couple of years, in ways to kill Unix machines. In other words, he tries to create scripts that will bring *nix machines to their knees. His interest isn’t malicious - he’s one of the most honest guys I know - but he thinks that by understanding where the weaknesses are, it will better enable him to shore those up and turn weaknesses into strengths. Robert knows Linux really, really, really well (actually, he knows RPM-based distros really well; Debian-based distros are still something new to him), but he bought a Mac OS X laptop a year ago, so now he’s focusing on ways to kill Mac OS X (which is still Unix, remember). Here’s his latest report, from the CWE-LUG mailing list:

<Robert’s email>

I was able to successfully kill my Mac last night with the following script [Scott: remove the blank lines from the script; this blog’s wysiwyg keeps inserting them]:

perl -le '
@foo=qw(hello) ;
for (my $i ; $i<100 ; $i++) {
push(@foo, @foo) || die "$i -- no more\n" ;
print "$i" ;
} ;
print "size is $#foo" ;
'

By killed I mean that without warning the Mac just turned off. When I powered on, it took a long time (probably doing an fsck) and then the time was set to January 1970. So, this was the hardest crash I have ever seen on a Unix box.

So I figured this script would be a good test for ulimit (bash, ksh ; limit in tcsh, csh). But no matter what setting I used for the various ulimit options, the script kept running, sucking up more and more RAM, until I manually stopped it with a Ctrl-C.

I’m curious to know if the above script kills anyone else’s machines and if setting ulimit/limit options prevents it?

</Robert’s email>

Jon, another member of the CWE-LUG list, is a big FreeBSD user, and he reported that the script did nothing on his FreeBSD box. It ran for 10 seconds or so & things slowed down, but then a warning appeared in the terminal - “Out of memory during request for 1012 bytes, total sbrk() is 535257088 bytes” - and things resumed as normal! On OpenBSD, the script ran for 4 seconds, maybe, and then gave an “Out of Memory” error, but there was no slowdown in performance.

What about the rest of you out there? Try it - ON A NON-PRODUCTION MACHINE!!! - & let us know!