1
0
mirror of https://github.com/golang/go synced 2024-09-29 14:24:32 -06:00
go/misc/cgo/testsanitizers
fanzha02 91e782106e runtime: fix the issue that the -asan option cannot print where the error occurred
The current -asan option does not print where the error occurred. The
reason is that the current implementation calls incorrect asan runtime
functions, which do not pass sp and pc where asan runtime functions are
called, and report the stack trace from the native code. But asan runtime
functions are called from cgo on a separated stack, so it cannot dump the
Go stack trace correctly.

The correct asan runtime function we should call is __asan_report_error,
which will pass sp and pc, and report where the error occurred correctly.

This patch fixes this issue.

Add the test cases.

Fixes #50362

Change-Id: I12ee1d46c7ae069ddef3d23f2fe86e112db60045
Reviewed-on: https://go-review.googlesource.com/c/go/+/374395
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-29 04:10:07 +00:00
..
testdata runtime: fix the issue that the -asan option cannot print where the error occurred 2021-12-29 04:10:07 +00:00
asan_test.go runtime: fix the issue that the -asan option cannot print where the error occurred 2021-12-29 04:10:07 +00:00
cc_test.go runtime: fix the issue that the -asan option cannot print where the error occurred 2021-12-29 04:10:07 +00:00
cshared_test.go all: update references to symbols moved from io/ioutil to io 2021-04-05 17:51:15 +00:00
msan_test.go runtime/cgo: when using msan explicitly unpoison cgoCallers 2021-08-09 14:48:39 +00:00
tsan_test.go