FreeBSD Bugzilla – Attachment 204522 Details for
Bug 231445
[patch] sleepq_catch_signals will still enter sleep after a ptrace attach event
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
For thread on sleepqueue, leave cleaning TDB_FSTP to the sleepq code.
1.patch (text/plain), 1.38 KB, created by
Konstantin Belousov
on 2019-05-21 21:10:04 UTC
(
hide
)
Description:
For thread on sleepqueue, leave cleaning TDB_FSTP to the sleepq code.
Filename:
MIME Type:
Creator:
Konstantin Belousov
Created:
2019-05-21 21:10:04 UTC
Size:
1.38 KB
patch
obsolete
>diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c >index 6e7339017fc..8dbcb87698b 100644 >--- a/sys/kern/kern_sig.c >+++ b/sys/kern/kern_sig.c >@@ -2576,7 +2576,15 @@ ptracestop(struct thread *td, int sig, ksiginfo_t *si) > p->p_xthread == NULL)) { > p->p_xsig = sig; > p->p_xthread = td; >- td->td_dbgflags &= ~TDB_FSTP; >+ >+ /* >+ * If we are on sleepqueue already, >+ * let sleepqueue code decide if it >+ * needs to go sleep after attach. >+ */ >+ if (td->td_wchan == NULL) >+ td->td_dbgflags &= ~TDB_FSTP; >+ > p->p_flag2 &= ~P2_PTRACE_FSTP; > p->p_flag |= P_STOPPED_SIG | P_STOPPED_TRACE; > sig_suspend_threads(td, p, 0); >diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c >index 6f256167100..79f2a139c7f 100644 >--- a/sys/kern/subr_sleepqueue.c >+++ b/sys/kern/subr_sleepqueue.c >@@ -498,6 +498,19 @@ sleepq_catch_signals(void *wchan, int pri) > } else { > mtx_unlock(&ps->ps_mtx); > } >+ >+ /* >+ * Do not go into sleep if this thread was the >+ * ptrace(2) attach leader. cursig() consumed >+ * SIGSTOP from PT_ATTACH, but we usually act >+ * on the signal by interrupting sleep, and >+ * should do it there as well. >+ */ >+ if ((td->td_dbgflags & TDB_FSTP) != 0) { >+ if (ret == 0) >+ ret = EINTR; >+ td->td_dbgflags &= ~TDB_FSTP; >+ } > } > /* > * Lock the per-process spinlock prior to dropping the PROC_LOCK
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 231445
:
197188
| 204522