Always set p_oppid when attaching to an existing process via procfs

tracing.  This matches the behavior of ptrace(PT_ATTACH).  Also,
the procfs detach request assumes p_oppid is always set.

Reviewed by:	kib
MFC after:	2 weeks
This commit is contained in:
John Baldwin 2015-05-22 11:03:51 +00:00
parent 1217b24e51
commit 312827253b

View File

@ -143,8 +143,8 @@ procfs_control(struct thread *td, struct proc *p, int op)
p->p_flag |= P_TRACED;
faultin(p);
p->p_xstat = 0; /* XXX ? */
if (p->p_pptr != td->td_proc) {
p->p_oppid = p->p_pptr->p_pid;
if (p->p_pptr != td->td_proc) {
proc_reparent(p, td->td_proc);
}
kern_psignal(p, SIGSTOP);