mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
Fix long standing bug that prevents the PT_CONTINUE, PT_KILL and
PT_DETACH ptrace(2) requests from functioning as advertised in the manual page. As described in kern/35175, the PT_DETACH request will, under certain circumstances, pass an unwanted signal on to the traced process upan detaching from it. The PT_CONTINUE request will sometimes fail if you make it pass a signal that has "properties" that differ from the properties of the signal that origionally caused the traced process to be stopped. Since PT_KILL is nothing than PT_CONTINUE with SIGKILL, it is broken too. In the PT_KILL case, this leads to an unkillable process. PR: 44011 Submitted by: Mark Kettenis <kettenis@chello.nl> Approved by: re(jhb)
This commit is contained in:
parent
98b2788832
commit
8d542cb56d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115046
@ -1917,7 +1917,6 @@ issignal(td)
|
||||
if (SIGISEMPTY(sigpending)) /* no signal to send */
|
||||
return (0);
|
||||
sig = sig_ffs(&sigpending);
|
||||
prop = sigprop(sig);
|
||||
|
||||
_STOPEVENT(p, S_SIG, sig);
|
||||
|
||||
@ -1952,14 +1951,6 @@ issignal(td)
|
||||
PROC_LOCK(p);
|
||||
mtx_lock(&ps->ps_mtx);
|
||||
|
||||
/*
|
||||
* If the traced bit got turned off, go back up
|
||||
* to the top to rescan signals. This ensures
|
||||
* that p_sig* and p_sigacts are consistent.
|
||||
*/
|
||||
if ((p->p_flag & P_TRACED) == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* If parent wants us to take the signal,
|
||||
* then it will leave it in p->p_xstat;
|
||||
@ -1970,6 +1961,14 @@ issignal(td)
|
||||
if (sig == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* If the traced bit got turned off, go back up
|
||||
* to the top to rescan signals. This ensures
|
||||
* that p_sig* and p_sigact are consistent.
|
||||
*/
|
||||
if ((p->p_flag & P_TRACED) == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Put the new signal into td_siglist. If the
|
||||
* signal is being masked, look for other signals.
|
||||
@ -1980,6 +1979,8 @@ issignal(td)
|
||||
signotify(td);
|
||||
}
|
||||
|
||||
prop = sigprop(sig);
|
||||
|
||||
/*
|
||||
* Decide whether the signal should be returned.
|
||||
* Return the signal's number, or fall through
|
||||
|
Loading…
Reference in New Issue
Block a user