]> Cypherpunks repositories - gostls13.git/commit
runtime: check for gsignal in asancall/msancall/racecall
authorMichael Pratt <mpratt@google.com>
Wed, 22 Jan 2025 19:13:33 +0000 (14:13 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 19 May 2025 18:20:58 +0000 (11:20 -0700)
commit11c86ddcb898f4c2c5fa548d46821ab76ea2d0fd
treeca9ac5f4925510a0415c6e5953be1cc8f39b385f
parentbc5aa2f7d3e1deb5468432230c438a8a9e8de316
runtime: check for gsignal in asancall/msancall/racecall

asancall and msancall are reachable from the signal handler, where we
are running on gsignal. Currently, these calls will use the g0 stack in
this case, but if the interrupted code was running on g0 this will
corrupt the stack and likely cause a crash.

As far as I know, racecall is not reachable from the signal handler, but
I have updated it as well for consistency.

This is the most straightforward fix, though it would be nice to
eventually migrate these wrappers to asmcgocall, which already handled
this case.

Fixes #71395.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15,gotip-linux-amd64-race
Change-Id: I6a6a636ccba826dd53e31c0e85b5d42fb1e98d12
Reviewed-on: https://go-review.googlesource.com/c/go/+/643875
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
15 files changed:
src/runtime/asan_amd64.s
src/runtime/asan_arm64.s
src/runtime/asan_loong64.s
src/runtime/asan_ppc64le.s
src/runtime/asan_riscv64.s
src/runtime/crash_cgo_test.go
src/runtime/msan_amd64.s
src/runtime/msan_arm64.s
src/runtime/msan_loong64.s
src/runtime/race_amd64.s
src/runtime/race_arm64.s
src/runtime/race_ppc64le.s
src/runtime/race_s390x.s
src/runtime/testdata/testprogcgo/tracebackctxt.go
src/runtime/testdata/testprogcgo/tracebackctxt_c.c