From owner-freebsd-bugs@freebsd.org Sat Jun 3 15:51:29 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB65DBF462A for ; Sat, 3 Jun 2017 15:51:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A9E07520E for ; Sat, 3 Jun 2017 15:51:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v53FpSWI057124 for ; Sat, 3 Jun 2017 15:51:28 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 175269] truss(1): truss -ff doesn't detach from processes properly Date: Sat, 03 Jun 2017 15:51:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jhb@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2017 15:51:30 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D175269 John Baldwin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jhb@FreeBSD.org --- Comment #2 from John Baldwin --- So when I run this I get an error from kill saying that - doesn't exis= t.=20 And in particular, sh doesn't create a new process group when it runs a scr= ipt, so there is no process group to kill so this keeps running forever. When y= ou run rsleeper.sh directly from the shell it is run in a new process group by= the shell which is why your 'kill -$$' works. I tried modifying truss to create a new process group for the child process, but the result of this is that the tty driver in the kernel no longer sends= a SIGINT to anything when Ctrl-C is pressed. (I ktrace'd the shell with inheritance and no processes got a SIGINT when Ctrl-C was hit). Note also = that the problem isn't that truss is stuck trying to detach, the problem is that= the child isn't exiting (and the Ctrl-C should be forcing the child to exit). = This probably has something to do with truss being the parent that the shell originally forks rather than being a "helper" process. Hmm, so truss explicitly ignores SIGINT/TERM/QUIT when exec'ing and the comment above that says "they should be passed off to the process", but using SIG_IGN doesn't = do that. Instead, it needs to "forward" signals to the child process. So I did a patch to forward the signals, and then also placed the new proce= ss in its own process group. This fixed the rsleeper.sh case, but probably ne= eds a bit more testing. Also, I'm not sure why you are using 'truss -ff' as the double -f doesn't mean anything to truss. --=20 You are receiving this mail because: You are the assignee for the bug.=