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 156966 Details for
Bug 242694
utrace: PTRACE_EVENT_EXIT report gets wrong wait status for group exit
[?]
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.
test case for second failure scenario
ptrace-signal0.c (text/x-csrc), 2.11 KB, created by
Roland McGrath
on 2007-06-14 08:37:28 UTC
(
hide
)
Description:
test case for second failure scenario
Filename:
MIME Type:
Creator:
Roland McGrath
Created:
2007-06-14 08:37:28 UTC
Size:
2.11 KB
patch
obsolete
>#define _GNU_SOURCE >#include <stdlib.h> >#include <stdio.h> >#include <unistd.h> >#include <sys/wait.h> >#include <sys/ptrace.h> >#include <linux/ptrace.h> >#include <pthread.h> >#include <assert.h> >#include <errno.h> >#include <error.h> > >#define PTRACE_EVENT(status) ((status) >> 16) > >static void * >thread_entry(void *arg) >{ > /* Child thread, just exit. */ > return NULL; >} > >int >main(int argc, char **argv) >{ > int pid = fork(); > assert(pid != -1); > > if (pid == 0) { > /* Child processes, wait a second for the parent to attach. */ > sleep(1); > > /* Create the child thread. */ > int res; > pthread_t thread; > pthread_attr_t attr; > res = pthread_attr_init(&attr); > assert(res == 0); > res = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); > assert(res == 0); > res = pthread_create(&thread, &attr, thread_entry, NULL); > assert(res == 0); > res = pthread_attr_destroy(&attr); > assert(res == 0); > > /* Exit. */ > pthread_exit(NULL); > } > else { > long res; > int status; > > /* Attach to the child process. */ > res = ptrace(PTRACE_ATTACH, pid, NULL, NULL); > assert(res != -1); > > /* Trace the child process until both threads have exited. */ > int exits = 0; > do { > pid_t tid = waitpid(-1, &status, __WALL); > assert(tid != -1); > > if (WIFSTOPPED(status)) { > printf("tid %d: signal %d, ptrace event %d\n", tid, WSTOPSIG(status), PTRACE_EVENT(status)); > assert(WSTOPSIG(status) != 0); > > res = ptrace(PTRACE_SETOPTIONS, tid, NULL, (void *)(PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXIT)); > if (res == -1) > error(2,errno,"PTRACE_SETOPTIONS"); > > res = ptrace(PTRACE_CONT, tid, NULL, (void *)0L); > if (res == -1) > error(2,errno,"PTRACE_CONT"); > } else if (WIFEXITED(status)) { > printf("tid %d: exit status %d\n", tid, WEXITSTATUS(status)); > exits++; > } > else > assert_perror(errno); > } while (exits < 2); > } > > 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 242694
:
156221
| 156966