lkml.org 
[lkml]   [1998]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.1.90 oops to go, drive through
I run following program for ten seconds and got a nice set of gpf's.

It creates them here, at least (I *hope* my custom egcs optimizations
aren't the problem! :-)

Hope this helps find some problems - it's similar to crashme, but it
directly tests random system calls instead of running random code.
-- Elliot
Chicken Little was right.
#define __USE_MISC
#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <sched.h>
#include <signal.h>

#define SYS_MAX (__NR_mremap + 1)
#define CHILD_TIMEOUT 5 /* Wait 5 seconds before hard-killing it */

inline void
my_syscall5(long sysnum, long arg1, long arg2,long arg3,long arg4, long arg5)
{
long __res;
__asm__ volatile ("int $0x80"
: "=a" (__res)
: "0" ((long)sysnum),"b" ((long)(arg1)),"c" ((long)(arg2)),
"d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)));
}


int main(void)
{
long sysnum, arg1, arg2, arg3, arg4, arg5;
pid_t pid, rpid;
time_t starttime;
int tmp;

srand(time(NULL));
while(1)
{
do { sysnum = rand() % SYS_MAX; } while(sysnum == __NR_pause);
arg1 = rand();
arg2 = rand();
arg3 = rand();
arg4 = rand();
arg5 = rand();
printf("syscall %#8.8lx: %#8.8lx %#8.8lx %#8.8lx %#8.8lx %#8.8lx\n", sysnum,
arg1, arg2, arg3, arg4, arg5);
pid = fork();
if(!pid)
{
/* Child */
my_syscall5(sysnum, arg1, arg2, arg3, arg4, arg5);
_exit(0);
} else {
starttime = time(NULL);
while((rpid=waitpid(pid, &tmp, WNOHANG)) == 0
&& (time(NULL) < starttime + CHILD_TIMEOUT))
sched_yield();
if(!rpid) {
printf("\nChild timed out\n\n"); fflush(stdout);
kill(pid, SIGKILL);
}
waitpid(pid, &tmp, 0);
}
}
return 0;
}
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.038 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site