From 93ad209f24f2f58089a1b516df5fc500ff760dca Mon Sep 17 00:00:00 2001 From: aarzilli Date: Sat, 26 Sep 2015 14:38:57 +0200 Subject: [PATCH] proc: bugfix: Detach(true) does not kill tracee Instead of using PTRACE_DETACH to inject SIGINT into the tracee use sys.Kill directly: PTRACE_DETACH is allowed to ignore its signal argument if the tracee isn't in signal-delivery-stop status. --- proc/proc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proc/proc.go b/proc/proc.go index b9624ab2..284f2eb4 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -101,11 +101,13 @@ func (dbp *Process) Detach(kill bool) (err error) { } } dbp.execPtraceFunc(func() { - var sig int + err = PtraceDetach(dbp.Pid, 0) + if err != nil { + return + } if kill { - sig = int(sys.SIGINT) + err = sys.Kill(dbp.Pid, sys.SIGINT) } - err = PtraceDetach(dbp.Pid, sig) }) return } -- GitLab