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 316855 Details for
Bug 461552
[utrace] strace -f => PANIC: attached pid # exited
[?]
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
clone-ptrace.c (text/plain), 3.40 KB, created by
Denys Vlasenko
on 2008-09-16 15:04:21 UTC
(
hide
)
Description:
Testcase
Filename:
MIME Type:
Creator:
Denys Vlasenko
Created:
2008-09-16 15:04:21 UTC
Size:
3.40 KB
patch
obsolete
>/* 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. */ > >#ifndef _GNU_SOURCE >#define _GNU_SOURCE >#endif >#include <assert.h> > >#ifdef __ia64__ >#define ia64_fpreg ia64_fpreg_DISABLE >#define pt_all_user_regs pt_all_user_regs_DISABLE >#endif /* __ia64__ */ >#include <sys/ptrace.h> >#ifdef __ia64__ >#undef ia64_fpreg >#undef pt_all_user_regs >#endif /* __ia64__ */ >#include <linux/ptrace.h> >#include <sys/types.h> >#include <sys/user.h> >#if defined __i386__ || defined __x86_64__ >#include <sys/debugreg.h> >#endif > >#include <stdlib.h> >#include <stdio.h> >#include <string.h> >#include <ctype.h> >#include <pthread.h> >#include <alloca.h> >#include <signal.h> >#include <errno.h> >#include <sys/types.h> >#include <sys/wait.h> >#include <unistd.h> >#include <linux/unistd.h> > >#define PTRACES 9999 > >static int child_stack[4 * 1024]; > >static int >sleep_and_exit0 (void *unused) >{ > exit (0); >} > >int >main (int ac, char *av[]) >{ > int l, status, ptraces; > pid_t pid, child, grandchild; > > child = fork (); > if (child == -1) > { > perror ("fork"); > exit (1); > } > > if (child == 0) > { > // child > l = ptrace (PTRACE_TRACEME, 0, (void *) 0, (void *) 0); > assert (l == 0); > l = raise (SIGSTOP); > assert (l == 0); > > child = > clone (sleep_and_exit0, child_stack + 2 * 1024, > CLONE_PTRACE | SIGCHLD, NULL); > if (child == -1) > { > perror ("fork in child"); > exit (1); > } > > if (wait (NULL) == -1) > { > perror ("wait for grandchild"); > exit (1); > } > > usleep (20 * 1000); > exit (0); > } > > // parent > usleep (20 * 1000); > pid = waitpid (-1, &status, 0); > assert (pid == child); >//fprintf (stderr, "s:%d e:%d\n", WIFSTOPPED (status), WIFEXITED (status)); > assert (WIFSTOPPED (status)); >//fprintf (stderr, "sig:%d\n", WSTOPSIG (status)); > assert (WSTOPSIG (status) == SIGSTOP); > > grandchild = -1; > for (ptraces = 0; ptraces < PTRACES; ptraces++) > { > if (pid > 0) > { > errno = 0; > ptrace (PTRACE_SYSCALL, pid, (void *) 1, (void *) 0); > assert_perror (errno); > } > > pid = waitpid (-1, &status, 0); > if (pid == child) > { >//fprintf (stderr, "child: s:%d e:%d\n", WIFSTOPPED (status), WIFEXITED (status)); > if (grandchild == -2 && WIFEXITED (status)) > { >//fprintf (stderr, "child exited %d\n", WEXITSTATUS (status)); > // Child is expected to exit only after grandchild > assert (WEXITSTATUS (status) == 0); > exit (0); > } > // Otherwise it must be a ptrace trap or grandchild exit > assert (WIFSTOPPED (status)); > assert (WSTOPSIG (status) == SIGTRAP > || WSTOPSIG (status) == SIGCHLD); > } > else if (grandchild == -1) > { > grandchild = pid; >//fprintf (stderr, "grandchild pid:%d\n", pid); > // the bug was here: kernel didn't SIGSTOP CLONE_PTRACEd child > assert (WIFSTOPPED (status)); > assert (WSTOPSIG (status) == SIGSTOP); > } > else > { > // It must be grandchild, must be a ptrace trap or exit >//fprintf (stderr, "grandchild\n", pid); > assert (pid == grandchild); > if (WIFEXITED (status)) > { > assert (WEXITSTATUS (status) == 0); > grandchild = -2; > pid = -1; > } > } > } >//fprintf (stderr, "looping too long!\n"); > assert (0); > return 1; >}
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 461552
: 316855