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 181161 Details for
Bug 248532
utrace: tkill(SIGCONT) is not reported by waitpid() under ptrace
[?]
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.
New testcase.
stopped-sigcont-hang-1.c (text/plain), 3.56 KB, created by
Jan Kratochvil
on 2007-08-30 14:28:37 UTC
(
hide
)
Description:
New testcase.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2007-08-30 14:28:37 UTC
Size:
3.56 KB
patch
obsolete
>/* Copyright 2007 Free Software Foundation, Inc. > > This program is free software; you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation; either version 2 of the License, or > (at your option) any later version. > > This program is distributed in the hope that it will be useful, > but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU General Public License for more details. > > You should have received a copy of the GNU General Public License > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ > >#define _GNU_SOURCE >#include <signal.h> >#include <unistd.h> >#include <string.h> >#include <stdio.h> >#include <stdlib.h> >#include <errno.h> >#include <sys/wait.h> >#include <sys/ptrace.h> >#include <assert.h> >#include <fcntl.h> >#include <limits.h> >#include <ctype.h> >#include <linux/ptrace.h> > >#include <asm/unistd.h> >#include <unistd.h> >#define tkill(tid, sig) syscall (__NR_tkill, (tid), (sig)) > >#define LOOPS 10000 >#define SIGSTOPS 100 > >static pid_t child; > >static void >cleanup (void) >{ > if (child != 0) > kill (child, SIGKILL); >} > >static void >handler_fail (int signo) >{ > cleanup (); > > signal (SIGABRT, SIG_DFL); > abort (); >} > >int main (void) >{ > pid_t got_pid; > int status; > int sigstops; > int loops; > > setbuf (stdout, NULL); > atexit (cleanup); > signal (SIGABRT, handler_fail); > signal (SIGALRM, handler_fail); > > sigstops = 0; > loops = 0; > for (loops = 0; sigstops < SIGSTOPS; loops++) > { > if (loops >= LOOPS) > { > fprintf (stderr, > "UNRESOLVED: %d SIGSTOPs, required %d, in %d loops\n", > sigstops, SIGSTOPS, loops); > exit (77); > } > > child = fork (); > switch (child) > { > case -1: > abort (); > case 0: > raise (SIGSTOP); > for (;;) > pause (); > /* NOTREACHED */ > default: > break; > } > alarm (1); > > /* We must never WAITPID/WAITID on the child for this testcase. */ > > /* Here is a point where we - as a debugger - start to attach. */ > errno = 0; > ptrace (PTRACE_ATTACH, child, NULL, NULL); > assert_perror (errno); > > /* `PTRACE_CONT, SIGSTOP' does not work in 100% cases as sometimes SIGSTOP > gets remembered by kernel during the first PTRACE_CONT later and we get > spurious SIGSTOP event. Expecting the signal may get delivered to > a different task of the thread group. > `tkill (SIGSTOP)' has no effect in this moment (it is already stopped). */ > errno = 0; > tkill (child, SIGCONT); > assert_perror (errno); > > got_pid = waitpid (child, &status, 0); > assert (got_pid == child); > assert (WIFSTOPPED (status)); > /* We may randomly get SIGCONT or SIGSTOP. */ > assert (WSTOPSIG (status) == SIGCONT || WSTOPSIG (status) == SIGSTOP); > if (WSTOPSIG (status) == SIGSTOP) > sigstops++; > > alarm (0); > > /* At this moment we should be already able to ptrace(2) the inferior. > If we got SIGCONT above ptrace(2) always works. > But if we got SIGSTOP above there was a regression on the patch > https://bugzilla.redhat.com/show_bug.cgi?id=248532#c5 > that we occasionally got ESRCH. */ > errno = 0; > ptrace (PTRACE_PEEKUSR, child, (void *) 0UL, NULL); > assert_perror (errno); > > /* Cleanup. */ > errno = 0; > kill (child, SIGKILL); > assert_perror (errno); > > got_pid = waitpid (child, &status, 0); > assert (got_pid == child); > > alarm (0); > } > > puts ("PASS"); > 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 248532
:
159411
|
179961
|
181161
|
182321
|
182381
|
185931
|
187231
|
191741