2 * COPYRIGHT (c) 1990 BY *
3 * GEORGE J. CARRETTE, CONCORD, MASSACHUSETTS. *
4 * ALL RIGHTS RESERVED *
6 Permission to use, copy, modify, distribute and sell this software
7 and its documentation for any purpose and without fee is hereby
8 granted, provided that the above copyright notice appear in all copies
9 and that both that copyright notice and this permission notice appear
10 in supporting documentation, and that the name of the author
11 not be used in advertising or publicity pertaining to distribution
12 of the software without specific, written prior permission.
14 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 HE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22 This code is based on crashme.c
26 #include <sys/param.h>
27 #include <sys/types.h>
50 printf("Hello, world (%d)\n", i);
55 alter(void) { /* Change one byte in the code */
58 buf[i] = random() & 0xff;
62 hand(int i) { /* alarm handler */
87 for (i = 0; i < 512; i++) {
89 bcopy(proto, buf, BUFS);
92 if ((pid = fork()) == 0) {
93 signal(SIGALRM, hand);
97 signal(SIGSEGV, hand);
100 signal(SIGSYS, hand);
101 signal(SIGTRAP, hand);
109 } else if (pid > 0) {
110 signal(SIGALRM, hand);
112 if (waitpid(pid, &status, 0) == -1)
113 warn("waitpid(%d)", pid);
117 err(1, "fork(), %s:%d", __FILE__, __LINE__);