diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-10-18 19:52:46 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-10-18 19:52:46 +0900 |
| commit | 4e993b48c8f5c1357c5d3d3315eb4b0ffac7c00b (patch) | |
| tree | 59236502b85c1f67165e6bf6419483c2b15a1741 /internal/testsuite | |
| parent | 6dca6818a254dd826a18138924faa1f72ab70d56 (diff) | |
internal/testsuite: lock tracer thread
This avoids getting the goroutine preempted and scheduled onto a
thread other than the tracer.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/testsuite')
| -rw-r--r-- | internal/testsuite/ptrace.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/testsuite/ptrace.go b/internal/testsuite/ptrace.go index b35816ec..d7abd0aa 100644 --- a/internal/testsuite/ptrace.go +++ b/internal/testsuite/ptrace.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "os" + "runtime" "syscall" "unsafe" ) @@ -113,6 +114,9 @@ func getFilter(pid, index int) ([]syscall.SockFilter, error) { // CheckFilter checks the process at pid to have its first filter's contents // match the specified sha512 checksum. func CheckFilter(pid, index int, sum [sha512.Size]byte) (err error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + if err = ptraceAttach(pid); err != nil { return } |
