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 185931 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.
[patch]
Roland's fix for the Comment 12 testcase.
bz248532c13.patch (text/plain), 3.35 KB, created by
Jan Kratochvil
on 2007-09-04 09:16:31 UTC
(
hide
)
Description:
Roland's fix for the Comment 12 testcase.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2007-09-04 09:16:31 UTC
Size:
3.35 KB
patch
obsolete
>From 4e59f8ca921d3656fd2b344a3bccc3dac5bce0bf Mon Sep 17 00:00:00 2001 >From: Roland McGrath <roland@redhat.com> >Date: Tue, 4 Sep 2007 01:57:34 -0700 >Subject: [PATCH] Fix ptrace_do_wait race with SIGCONT wakeup > >This fixes ptrace_do_wait to distinguish ptrace stops from job control >stops and never report as stopped a task that's neither in a ptrace stop >nor in TASK_STOPPED state. Previously, a ptrace'd task in TASK_RUNNING >could be reported as stopped when SIGCONT had just woken it (but it had not >yet cleared its ->exit_code). > >Signed-off-by: Roland McGrath <roland@redhat.com> >--- > kernel/ptrace.c | 41 +++++++++++++++++++++++++++++++++++++++-- > 1 files changed, 39 insertions(+), 2 deletions(-) > >diff --git a/kernel/ptrace.c b/kernel/ptrace.c >index 99f2c68..d4fda84 100644 >--- a/kernel/ptrace.c >+++ b/kernel/ptrace.c >@@ -79,6 +79,14 @@ struct ptrace_state > > static const struct utrace_engine_ops ptrace_utrace_ops; /* Initialized below. */ > >+/* >+ * We use this bit in task_struct.exit_code of a ptrace'd task to indicate >+ * a ptrace stop. It must not overlap with any bits used in real exit_code's. >+ * Those are (PTRACE_EVENT_* << 8) | 0xff. >+ */ >+#define PTRACE_TRAPPED_MASK 0x10000 >+ >+ > static void > ptrace_state_unlink(struct ptrace_state *state) > { >@@ -1292,7 +1300,29 @@ ptrace_do_wait(struct task_struct *tsk, > * check fails we are sure to get a wakeup if it stops. > */ > exit_code = xchg(&p->exit_code, 0); >- if (exit_code) >+ if (exit_code & PTRACE_TRAPPED_MASK) >+ goto found; >+ >+ /* >+ * If p was in job-control stop (TASK_STOPPED) rather than >+ * ptrace stop (TASK_TRACED), then SIGCONT can asynchronously >+ * clear it back to TASK_RUNNING. Until it gets scheduled >+ * and clears its own ->exit_code, our xchg below will see >+ * its stop signal. But, we must not report it if it's no >+ * longer in TASK_STOPPED, as vanilla wait would not--the >+ * caller can tell if it sent the SIGCONT before calling >+ * wait. We must somehow distinguish this from the case >+ * where p is in TASK_RUNNING with p->exit_code set because >+ * it is on its way to entering TASK_TRACED (QUIESCE) for our >+ * stop. So, ptrace_report sets the PTRACE_TRAPPED_MASK bit >+ * in exit_code when it's setting QUIESCE. For a job control >+ * control stop, that bit will never have been set. Since >+ * the bit's not set now, we should only report right now if >+ * p is still stopped. For this case we are protected by >+ * races the same wait that vanilla do_wait (exit.c) is: >+ * wait_chldexit is woken after p->state is set to TASK_STOPPED. >+ */ >+ if (p->state == TASK_STOPPED) > goto found; > > // XXX should handle WCONTINUED >@@ -1343,6 +1373,7 @@ found: > } > else { > why = CLD_TRAPPED; >+ exit_code &= ~PTRACE_TRAPPED_MASK; > status = exit_code; > exit_code = (status << 8) | 0x7f; > } >@@ -1510,8 +1541,14 @@ ptrace_report(struct utrace_attached_engine *engine, > */ > utrace_set_flags(tsk, engine, engine->flags | UTRACE_ACTION_QUIESCE); > >+ /* >+ * The PTRACE_TRAPPED_MASK bit distinguishes to ptrace_do_wait that >+ * this is a ptrace report, so we expect to enter TASK_TRACED but >+ * might not be there yet when examined. >+ */ > BUG_ON(code == 0); >- tsk->exit_code = code; >+ WARN_ON(code &~ 0x7ff); >+ tsk->exit_code = code | PTRACE_TRAPPED_MASK; > do_notify(tsk, state->parent, CLD_TRAPPED); > > pr_debug("%d ptrace_report quiescing exit_code %x\n", >-- >1.5.2.4
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248532
:
159411
|
179961
|
181161
|
182321
|
182381
| 185931 |
187231
|
191741