You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// attach to a running processerr=syscall.PtraceAttach(pid)
iferr!=nil {
returnfmt.Errorf("ptrace attach: %v", err)
}
// read registersregs:=&syscall.PtraceRegs{}
err=syscall.PtraceGetRegs(pid, regs)
iferr!=nil {
returnfmt.Errorf("my pid is %d, reading regs from %d: %v", os.Getpid(), pid, err)
}
What did you expect to see?
Registers are successfully returned
What did you see instead?
my pid is 4018, reading regs from 4028: no such process from syscall.PtraceGetRegs(pid, regs)
The issue
The process I was trying to attach to is attachable, as syscall.PtraceAttach(pid) returns no error
Checking the /proc/$(pidof tracee)/status, found a TracerPid matching a non-existent process, I think it's a thread (which has already exited) of my go program
Putting runtime.LockOSThread() at the beginning of my function doesn't solve this issue, TracerPid still doesn't match my current go process, which it should
The text was updated successfully, but these errors were encountered:
jm33-m0
changed the title
syscall.Ptrace* always start in new thread, causing the tracee untracable
syscall.Ptrace* always start in new thread, causing the tracee untraceable
Jan 14, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Registers are successfully returned
What did you see instead?
my pid is 4018, reading regs from 4028: no such process
fromsyscall.PtraceGetRegs(pid, regs)
The issue
syscall.PtraceAttach(pid)
returns no error/proc/$(pidof tracee)/status
, found aTracerPid
matching a non-existent process, I think it's a thread (which has already exited) of my go programruntime.LockOSThread()
at the beginning of my function doesn't solve this issue,TracerPid
still doesn't match my current go process, which it shouldThe text was updated successfully, but these errors were encountered: