proc: unlock OS thread on exit from handlePtraceFuncs (#2972)
On FreeBSD and OpenBSD, the use of runtime.LockOSThread is resulting in segfaults within the Go runtime (see https://github.com/golang/go/issues/52394) - while it should not be necessary, calling runtime.UnlockOSThread upon exit from handlePtraceFuncs avoids this issue and allows the tests to run correctly.
This commit is contained in:
parent
7ab33ac92f
commit
5b16ddb7e2
@ -271,6 +271,13 @@ func (dbp *nativeProcess) handlePtraceFuncs() {
|
|||||||
// all commands after PTRACE_ATTACH to come from the same thread.
|
// all commands after PTRACE_ATTACH to come from the same thread.
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
|
|
||||||
|
// Leaving the OS thread locked currently leads to segfaults in the
|
||||||
|
// Go runtime while running on FreeBSD and OpenBSD:
|
||||||
|
// https://github.com/golang/go/issues/52394
|
||||||
|
if runtime.GOOS == "freebsd" || runtime.GOOS == "openbsd" {
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
}
|
||||||
|
|
||||||
for fn := range dbp.ptraceChan {
|
for fn := range dbp.ptraceChan {
|
||||||
fn()
|
fn()
|
||||||
dbp.ptraceDoneChan <- nil
|
dbp.ptraceDoneChan <- nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user