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.
This commit is contained in:
aarzilli
2015-09-26 14:38:57 +02:00
parent 466960d95a
commit 93ad209f24

View File

@ -101,11 +101,13 @@ func (dbp *Process) Detach(kill bool) (err error) {
}
}
dbp.execPtraceFunc(func() {
var sig int
if kill {
sig = int(sys.SIGINT)
err = PtraceDetach(dbp.Pid, 0)
if err != nil {
return
}
if kill {
err = sys.Kill(dbp.Pid, sys.SIGINT)
}
err = PtraceDetach(dbp.Pid, sig)
})
return
}