Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 311664 Details for
Bug 455179
SIGKILL may crash in flush_old_exec/release_task
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Testcase.
exitcrash.c (text/plain), 2.81 KB, created by
Jan Kratochvil
on 2008-07-13 14:37:45 UTC
(
hide
)
Description:
Testcase.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2008-07-13 14:37:45 UTC
Size:
2.81 KB
patch
obsolete
>#define _GNU_SOURCE >/* This software is provided 'as-is', without any express or implied > warranty. In no event will the authors be held liable for any damages > arising from the use of this software. > > Permission is granted to anyone to use this software for any purpose, > including commercial applications, and to alter it and redistribute it > freely. */ > >#include <stdio.h> >#include <unistd.h> >#include <pthread.h> >#include <signal.h> >#include <stdlib.h> >#include <string.h> >#include <assert.h> >#include <errno.h> >#include <sys/wait.h> >#include <sys/ptrace.h> > >/* WARNING: The real testing count is probably unbound. */ >#define DEFAULT_TESTTIME 10 /* seconds */ > >#define FORKS 16 > >static volatile pid_t forks[FORKS]; > >static void >cleanup (void) >{ > int forki; > > for (forki = 0; forki < FORKS; forki++) > if (forks[forki] > 0) > kill (forks[forki], SIGKILL); >} > >static void >handler_fail (int signo) >{ > cleanup (); > > signal (signo, SIG_DFL); > raise (signo); >} > >static void * >thread_func (void *argv0_pointer) >{ > execl ("/proc/self/exe", argv0_pointer, "child", NULL); > assert_perror (errno); > assert (0); > /* NOTREACHED */ >} > >static void >child (const char *argv0) >{ > pthread_t thread; > int i; > > errno = 0; > i = pthread_create (&thread, NULL, thread_func, (void *) argv0); > assert_perror (errno); > assert (i == 0); > > while (1) > pause(); > /* NOTREACHED */ > assert (0); >} > >static void >kill_safe (pid_t pid) >{ > pid_t got; > int status; > > do > { > int i; > > errno = 0; > i = kill (pid, SIGKILL); > if (errno == ESRCH) > { > /* It may happen even during the first cycle as the process still may > not be initialized. Wait till it appears in such case. */ > assert (i == -1); > } > else > { > assert_perror (errno); > assert (i == 0); > } > > errno = 0; > got = waitpid (pid, &status, WNOHANG); > assert_perror (errno); > } > while (got == 0); > assert (got == pid); > assert (WIFSIGNALED (status)); > assert (WTERMSIG (status) == SIGKILL); >} > >int >main (int argc, char **argv) >{ > char *testtime = getenv ("TESTTIME"); > time_t testend = time (NULL) + (testtime != NULL ? atoi (testtime) > : DEFAULT_TESTTIME); > > atexit (cleanup); > signal (SIGABRT, handler_fail); > signal (SIGINT, handler_fail); > signal (SIGALRM, handler_fail); > alarm (10); > > if ((argc == 2 && strcmp (argv[1], "child") == 0)) > { > child (argv[0]); > /* NOTREACHED */ > assert (0); > } > > do > { > int forki; > > for (forki = 0; forki < FORKS; forki++) > { > alarm (10); > > if (forks[forki] > 0) > kill_safe (forks[forki]); > > forks[forki] = fork (); > switch (forks[forki]) > { > case -1: > assert_perror (errno); > case 0: > child (argv[0]); > /* NOTREACHED */ > assert (0); > default: > break; > } > > } > } > while (time (NULL) < testend); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 455179
: 311664