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 211781 Details for
Bug 313111
utrace: crash - utrace_get_signal
[?]
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, a modified one from adobriyan-at-sw.ru.
clone-get-signal.c (text/plain), 2.46 KB, created by
Jan Kratochvil
on 2007-09-30 14:55:11 UTC
(
hide
)
Description:
Testcase, a modified one from adobriyan-at-sw.ru.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2007-09-30 14:55:11 UTC
Size:
2.46 KB
patch
obsolete
>/* F-8?: https://bugzilla.redhat.com/show_bug.cgi?id=312951 */ >/* F-7?: https://bugzilla.redhat.com/show_bug.cgi?id=313081 */ >/* private RHEL-5.2?: https://bugzilla.redhat.com/show_bug.cgi?id=312961 */ > >/* 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. */ > >/* zap_threads() does __ptrace_unlink(p) under write_lock(tasklist_lock), > what if p->parent waits for tasklist_lock in ptrace_detach() ? > > This program crashes the kernel (both 2.6.15 and 2.6.16-rc2 were tested) > very quickly (BUG() in __ptrace_unlink). */ > >#include <errno.h> >#include <stdio.h> >#include <signal.h> >#include <string.h> >#include <stdlib.h> >#include <unistd.h> >#include <pthread.h> >#include <sys/wait.h> >#include <sys/ptrace.h> >#include <sys/syscall.h> > >/* WARNING: Check the real count. */ >#define LOOPS 2000 > >static void die (const char *msg) >{ > printf ("ERR!! %s: %s\n", msg, strerror(errno)); > exit (1); >} > >#ifdef __ia64__ >extern int __clone2 (int (*fn)(void *), void *child_stack_base, > size_t stack_size, int flags, void *arg, ...); >#define clone2 __clone2 >#else >#define clone2(func, stack_base, size, flags, arg...) \ > clone (func, (stack_base) + (size), flags, arg) >#endif > >static pid_t clone_vm (int (*fn) (void *), void *stack_base, size_t stack_size) >{ > pid_t pid; > > pid = clone2 (fn, stack_base, stack_size, CLONE_VM, NULL); > if (pid < 0) > die ("clone"); > > return pid; >} > >static unsigned char child_stack[4096]; > >static int child_func (void *arg) >{ > return pause (); >} > >static unsigned char cdump_stack[4096]; > >static int cdump_func (void *arg) >{ > return kill (syscall(__NR_getpid), SIGQUIT); >} > >int main (void) >{ > int pid; > int loops; > > for (loops = 0; loops < LOOPS; loops++) > if ((pid = fork())) { > if (waitpid (pid, NULL, 0) != pid) > die ("wait"); > kill (-pid, SIGKILL); > } else { > int child; > > if (setpgrp ()) > die("pgrp"); > > child = clone_vm (child_func, child_stack, > sizeof child_stack); > > if (ptrace (PTRACE_ATTACH, child, NULL, 0)) > die ("ptrace"); > > if (waitpid (child, NULL, __WALL) != child) > die ("wait"); > > clone_vm (cdump_func, cdump_stack, sizeof cdump_stack); > > if (ptrace (PTRACE_DETACH, child, NULL, 0)) > die ("detach"); > > break; > } > > 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 313111
: 211781