Skip to content

runtime/pprof: SIGPROF crashes process on netbsd/amd64 #10166

@bsiegert

Description

@bsiegert

This is on

$ uname -a
NetBSD edamame.mirbsd.org 7.0_BETA NetBSD 7.0_BETA (GENERIC.201501181820Z) amd64
$ go version
go version devel +3b1d692 Sat Mar 14 10:47:19 2015 +0000 netbsd/amd64

At tip, the runtime/pprof test fails, which also makes all.bash fail:

=== RUN TestMemoryProfiler
--- PASS: TestMemoryProfiler (0.02s)
=== RUN TestCPUProfile
exit status 255
FAIL    runtime/pprof   0.038s

Looking at ktrace output, it looks like the SIGPROF is what kills the process:

 16246      3 pprof.test RET   compat_60__lwp_park -1 errno 4
Interrupted system call
 16246      3 pprof.test PSIG  SIGPROF caught handler=0x456980
mask=(): code=SI_TIMER sent by pid=0, uid=0 with sigval 0x2)
 16246      3 pprof.test CALL  setcontext(0x40)
 16246      3 pprof.test RET   setcontext -1 errno 14 Bad address
 16246      3 pprof.test CALL  exit(0xffffffffffffffff)

According to Minux:

has NetBSD changed kernel signal handler ABI?
or there might some stack/register corruption in runtime.sigtramp. The implicit
setcontext(2) is picking up a wrong address for ucontext. Should we preserve
callee-saved registers in runtime.sigtramp? I'd start by setting a break on
runtime.sigtramp, and then disassemble the function it should return to and try
understand where does 0x40 come from.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions