aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2021-12-30 11:09:42 +0800
committerFannie Zhang <Fannie.Zhang@arm.com>2022-01-05 09:50:29 +0000
commit2c58bb2e428c1f587dc30817bc211570f6fd4793 (patch)
treef1621f6baa6301e7893c74b4bf40d8287e0e4278 /src/runtime
parent301db3f5d2d38a13aafe5bc6efea9a3bdbfc475e (diff)
downloadgo-2c58bb2e428c1f587dc30817bc211570f6fd4793.tar.xz
src/runtime: mark asanread and asanwrite functions as NOSPLIT
The asan runtime functions may run on stacks that cannot grow, and they do not have large local variables, so it is safe to mark them as NOSPLIT. Add test case. Fixes #50391 Change-Id: Iadcbf1ae0c837d9b64da5be208c7f424e6ba11de Reviewed-on: https://go-review.googlesource.com/c/go/+/374398 Trust: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Fannie Zhang <Fannie.Zhang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asan.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/asan.go b/src/runtime/asan.go
index affafd4d8d..26656cd975 100644
--- a/src/runtime/asan.go
+++ b/src/runtime/asan.go
@@ -26,12 +26,16 @@ func ASanWrite(addr unsafe.Pointer, len int) {
// Private interface for the runtime.
const asanenabled = true
+// Mark asan(read, write) as NOSPLIT, because they may run
+// on stacks that cannot grow. See issue #50391.
+//go:nosplit
func asanread(addr unsafe.Pointer, sz uintptr) {
sp := getcallersp()
pc := getcallerpc()
doasanread(addr, sz, sp, pc)
}
+//go:nosplit
func asanwrite(addr unsafe.Pointer, sz uintptr) {
sp := getcallersp()
pc := getcallerpc()