* fork() and 2.2.1
[not found] <Pine.LNX.4.04.9902152243060.11190-100000@toshiba-53-90.nycap.rr.com>
@ 1999-02-16 4:47 ` Dan Morrill
1999-02-16 4:58 ` Ross A. Knepper
1999-02-18 6:21 ` flush cache? Bruce Ediger
0 siblings, 2 replies; 4+ messages in thread
From: Dan Morrill @ 1999-02-16 4:47 UTC (permalink / raw)
To: axp-list
<QUESTION TYPE="STUPID">
*sigh* I ruined my uptime. (14 days 22 hours on 2.2.1. Oh well. :)
I forkbombed my Alpha to see what would happen.
By "forkbomb" I mean:
#include <unistd.h>
#include <stdio.h>
int main( int argc, char** argv ) {
int i = 0;
while (fork())
printf( "Hi! %d\n", i++ );
return 0;
}
(Yes, I have too much free time.)
No problemo; I just did a:
while true; do ps aux | grep -v grep | grep morrildl | awk '{ print $2; }' | \
xargs kill -KILL; done
...as root and morrildl went bye-bye.
Well, except for one last unkillable zombie process. I was under the
impression that no process should be unkillable to SIGKILL. Since this SIG is
intercepted by the OS and not the process, is this a bug in the kernel, or a
"feature" I don't know about? Is this maybe an Alpha-specific thing? (I don't
recall ever seeing this happen on Intel.)
</QUESTION>
(I lost my uptime because I rebooted to get rid of this zombie process; even
though it wasn't burning any cycles, looking at unkillable zombie processes
in ps makes me nervous. :)
Dan Morrill
Computer Scientist, Physicist
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fork() and 2.2.1
1999-02-16 4:47 ` fork() and 2.2.1 Dan Morrill
@ 1999-02-16 4:58 ` Ross A. Knepper
1999-02-16 15:59 ` Mark Conway Wirt
1999-02-18 6:21 ` flush cache? Bruce Ediger
1 sibling, 1 reply; 4+ messages in thread
From: Ross A. Knepper @ 1999-02-16 4:58 UTC (permalink / raw)
To: axp-list
On Mon, 15 Feb 1999, Dan Morrill wrote:
> I forkbombed my Alpha to see what would happen.
> (Yes, I have too much free time.)
heh. most people just play quake ...
[snip]
> Well, except for one last unkillable zombie process. I was under the
> impression that no process should be unkillable to SIGKILL. Since this SIG is
> intercepted by the OS and not the process, is this a bug in the kernel, or a
> "feature" I don't know about? Is this maybe an Alpha-specific thing? (I don't
> recall ever seeing this happen on Intel.)
a zombie is a process which has exited, but whose exit status has not yet
been collected. in general these only occur if the parent process is
still alive, since otherwise init (pid 1) inherits the process and wait()s
on it to allow the zombie to go away. so a zombie occurs when the parent
is still alive but for some reason is not wait()ing to collect the exit
status of the deceased child.
since a zombie is already dead, it won't hurt anything. it takes up only
minimal resources ... so you probably didnt need to reboot and lose your
uptime.
-ross
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fork() and 2.2.1
1999-02-16 4:58 ` Ross A. Knepper
@ 1999-02-16 15:59 ` Mark Conway Wirt
0 siblings, 0 replies; 4+ messages in thread
From: Mark Conway Wirt @ 1999-02-16 15:59 UTC (permalink / raw)
To: axp-list
On Mon, Feb 15, 1999 at 11:58:40PM -0500, Ross A. Knepper wrote:
>
> a zombie is a process which has exited, but whose exit status has not yet
> been collected. in general these only occur if the parent process is
> still alive, since otherwise init (pid 1) inherits the process and wait()s
> on it to allow the zombie to go away. so a zombie occurs when the parent
> is still alive but for some reason is not wait()ing to collect the exit
> status of the deceased child.
Often, you can do a
ps aufx
to find the parent and kill it (assuming that it's no init). More
often than not, this will get rid of a zombie.
--Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* flush cache?
1999-02-16 4:47 ` fork() and 2.2.1 Dan Morrill
1999-02-16 4:58 ` Ross A. Knepper
@ 1999-02-18 6:21 ` Bruce Ediger
1 sibling, 0 replies; 4+ messages in thread
From: Bruce Ediger @ 1999-02-18 6:21 UTC (permalink / raw)
To: axp-list
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1035 bytes --]
I have a rather bizarre little program I want to run under AlphaLinux
(RH 5.0, kernel 2.0.30). The program allocates some memory via malloc(),
does a memcpy() of a function to that newly-allocated memory, then calls
that newly-allocated memory via a function pointer. That call causes
signal 11 (SEGV) every single time. I'm at a loss, since malloc()
gives back memory on a divisible-by-8 address. I've tried to make sure
that the program page-aligns the memory, and that the program marks the
memory PROT_READ|PROT_EXEC.
I think that maybe the program should get the CPU to do a cache flush.
I found a man page for cacheflush(2), but apparently cacheflush(2)
only works on MIPS processors. I should probably write some embedded
assembly, but I don't what instructions to embed.
Anybody got any ideas? My Alpha is a 166 MHz 21064 UDB (VX-40).
I attached the program in question.
--
Everything leads to weariness - a weariness to great for words. Our eyes
can never see enough to be satisfied; our ears can never hear enough.
[-- Attachment #2: Type: TEXT/PLAIN, Size: 3623 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
/* $Id: cpup4.c,v 1.1 1999/02/18 05:45:03 bediger Exp bediger $ */
typedef int (*fxptr)(
int, int, int (*)(const char *, ...),
void *,
void *(*)(void *, const void *, size_t),
void *(*)(size_t),
void (*)(void *),
size_t
);
char *signal_string(int sig);
void signal_handler(int sig);
int main(int ac, char **av);
int copyup(
int i,
int j,
int (*xptr)(const char *, ...),
void *yptr,
void *(*bptr)(void *, const void *, size_t),
void *(*mptr)(size_t),
void (*ffptr)(void *),
size_t size
);
void f1(void);
void f2(void);
/* return a string for the most common signals this program
* will generate. Probably could replace this with strerror()
*/
char *
signal_string(sig)
int sig;
{
char *bpr = "Don't know what signal";
switch (sig)
{
case SIGILL:
bpr = "Illegal instruction";
break;
case SIGSEGV:
bpr = "Segmentation violation";
break;
case SIGBUS:
bpr = "Bus error";
break;
}
return bpr;
}
/* Use of fprintf() seems sketchy. I think that signal_handler() doesn't
* need special compiler treatment like generating Position Independent
* Code. It stays in one place, and the kernel knows that place.
*/
void
signal_handler(int sig)
{
(void)fprintf(
stderr,
"%s: sig = 0x%x\n",
signal_string(sig),
sig
);
exit(99);
}
int
main(int ac, char **av)
{
int i, j;
/* check to see if cmd line has a number on it */
if (ac < 2) {
printf("not enough arguments\n");
exit(99);
}
/* install 3 different signal handlers - avoid core dumps */
if (-1 == (i = (long)signal(SIGSEGV, signal_handler)))
{
perror("Installing SIGSEGV signal failed");
exit(33);
}
if (-1 == (i = (long)signal(SIGILL, signal_handler)))
{
perror("Installing SIGILL signal handler failed");
exit(33);
}
if (-1 == (i = (long)signal(SIGBUS, signal_handler)))
{
perror("Installing SIGBUS signal handler failed");
exit(33);
}
setbuf(stdout, NULL);
/*
* print out addresses of original functions so there is something to
* reference during recursive function copying and calling
*/
printf(
"main = %p, copyup %p, memcpy %p, malloc %p, printf %p, free %p, size %ld\n",
main, copyup, memcpy, malloc, printf, free, (size_t)f2 - (size_t)f1);
if ((i = atoi(*(av + 1))) < 1) {
printf(" i = %d, i must be > 1\n", i);
exit(99);
}
printf(" going for %d recursions\n", i);
j = copyup(1, i, printf, copyup, memcpy, malloc, free, (size_t)f2 - (size_t)f1);
printf("copyup at %p returned %d\n", copyup, j);
return 1;
}
void f1(void) {return;}
int
copyup(
int i, int j,
int (*xptr)(const char *, ...),
void *yptr,
void *(*bptr)(void *, const void*, size_t),
void *(*mptr)(size_t),
void (*ffptr)(void *),
size_t size
)
{
fxptr fptr;
int k;
if (i == j)
{
(*xptr)("function at %p got to %d'th copy\n", yptr, i);
return i;
} else
(*xptr)("function at %p, i = %d, j = %d\n", yptr, i, j);
if (!(fptr = (fxptr)(*mptr)(size)))
{
(*xptr)("ran out of memory allocating new function\n");
return -1;
}
(*bptr)(fptr, yptr, size);
k = (*fptr)(i + 1, j, xptr, (void *)fptr, bptr, mptr, ffptr, size);
(*xptr)("function at %p got %d back from function at %p\n",
yptr, k, fptr);
(*ffptr)(fptr);
return (k + 1);
}
void f2(void) {return;}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-02-18 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.04.9902152243060.11190-100000@toshiba-53-90.nycap.rr.com>
1999-02-16 4:47 ` fork() and 2.2.1 Dan Morrill
1999-02-16 4:58 ` Ross A. Knepper
1999-02-16 15:59 ` Mark Conway Wirt
1999-02-18 6:21 ` flush cache? Bruce Ediger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox