FreeBSD Bugzilla – Attachment 197188 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
file_231445.txt (text/plain), 1.37 KB, created by
Efi Weiss
on 2018-09-18 10:56:06 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Efi Weiss
Created:
2018-09-18 10:56:06 UTC
Size:
1.37 KB
patch
obsolete
>diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c >index d6db629db6c..45ebbe74683 100644 >--- a/sys/kern/subr_sleepqueue.c >+++ b/sys/kern/subr_sleepqueue.c >@@ -436,7 +436,8 @@ sleepq_catch_signals(void *wchan, int pri) > struct thread *td; > struct proc *p; > struct sigacts *ps; >- int sig, ret; >+ int sig, ret, traced; >+ sigset_t sigpending; > > ret = 0; > td = curthread; >@@ -480,6 +481,9 @@ sleepq_catch_signals(void *wchan, int pri) > if ((td->td_flags & TDF_NEEDSIGCHK) != 0) { > ps = p->p_sigacts; > mtx_lock(&ps->ps_mtx); >+ sigpending = td->td_sigqueue.sq_signals; >+ SIGSETOR(sigpending, p->p_sigqueue.sq_signals); >+ SIGSETNAND(sigpending, td->td_sigmask); > sig = cursig(td); > if (sig == -1) { > mtx_unlock(&ps->ps_mtx); >@@ -498,6 +502,15 @@ sleepq_catch_signals(void *wchan, int pri) > mtx_unlock(&ps->ps_mtx); > } else { > mtx_unlock(&ps->ps_mtx); >+ PROC_SLOCK(p); >+ traced = (p->p_flag & TRACED); >+ PROC_SUNLOCK(p); >+ if (traced && SIGISMEMBER(sigpending, SIGSTOP)) { >+ // Interrupt sleeping syscalls when the the SIGSTOP was consumed by ptrace attach >+ // This is so the debugged process will be left >+ // in the same state as if it already entered sleep >+ ret = EINTR; >+ } > } > } > /*
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 231445
: 197188 |
204522