From 201165c60bd624e96ef0f3bf27c315a679d9aed4 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 15 Jun 2015 18:16:23 +0000 Subject: MFC r283889,r283891: Clear p_stops when doing PT_DETACH and PROCFS_CTL_DETACH. Without this, if a process was being traced by truss(1), which uses different p_stops bits than gdb(1), the latter would misbehave because of the unexpected bits. Reported by: jceel Submitted by: sef Sponsored by: iXsystems, Inc. --- sys/fs/procfs/procfs_ctl.c | 1 + sys/kern/sys_process.c | 1 + 2 files changed, 2 insertions(+) (limited to 'sys') diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c index dc267f6..5a32863 100644 --- a/sys/fs/procfs/procfs_ctl.c +++ b/sys/fs/procfs/procfs_ctl.c @@ -235,6 +235,7 @@ out: } else PROC_LOCK(p); p->p_oppid = 0; + p->p_stops = 0; p->p_flag &= ~P_WAITED; /* XXX ? */ sx_xunlock(&proctree_lock); diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 3bf2db8..09a43f4 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -963,6 +963,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) CTR1(KTR_PTRACE, "PT_DETACH: pid %d", p->p_pid); p->p_oppid = 0; p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); + p->p_stops = 0; /* should we send SIGCHLD? */ /* childproc_continued(p); */ -- cgit v1.1