runtime: prevent deadlock when profiling signal arrives during traceback
authorIan Lance Taylor <ian@gcc.gnu.org>
Sat, 5 Jan 2019 00:40:04 +0000 (00:40 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 5 Jan 2019 00:40:04 +0000 (00:40 +0000)
commitf6be1179bb66624403d0f55620d67344d9d98c51
tree29cb9bb891a22723eb9b089c40e3f32bff282e09
parent869fbd357e1936b0c1239bc2a336de34fd45b79e
runtime: prevent deadlock when profiling signal arrives during traceback

    Traceback routines, e.g. callers and funcentry, may call
    __go_get_backtrace_state. If a profiling signal arrives while we
    are in the critical section of __go_get_backtrace_state, it tries
    to do a traceback, which also calls __go_get_backtrace_state,
    which tries to enter the same critical section and will deadlock.
    Prevent this deadlock by setting up runtime_in_callers before
    calling __go_get_backtrace_state.

    Found while investigating golang/go#29448. Will add a test in the
    next CL.

    Updates golang/go#29448.

    Reviewed-on: https://go-review.googlesource.com/c/156037

From-SVN: r267590
gcc/go/gofrontend/MERGE
libgo/runtime/go-caller.c
libgo/runtime/go-callers.c