• Cherry Zhang's avatar
    runtime: always use Go signal stack in non-cgo program · 73d20f81
    Cherry Zhang authored
    When initializing an M, we set up its signal stack to the gsignal
    stack if an alternate signal stack is not already set. On Android,
    an alternate signal stack is always set, even cgo is not used.
    This breaks the logic of saving/fetching G on the signal stack
    during VDSO, which assumes the signal stack is allocated by Go if
    cgo is not used (if cgo is used, we use TLS for saving G).
    
    When cgo is not used, we can always use the Go signal stack, even
    if an alternate signal stack is already set. Since cgo is not
    used, no one other than the Go runtime will care.
    
    Fixes #35554.
    
    Change-Id: Ia9d84cd55cb35097f3df46f37996589c86f10e0f
    Reviewed-on: https://go-review.googlesource.com/c/go/+/207445
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    73d20f81
signal_unix.go 34.7 KB