From: Ian Lance Taylor Date: Mon, 7 Jul 2025 20:01:34 +0000 (-0700) Subject: cmd/compile: document that nosplit directive is unsafe X-Git-Tag: go1.25rc3~5^2~43 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bb917bb0303843467e809a3a373e4bb2d359fcfa;p=gostls13.git cmd/compile: document that nosplit directive is unsafe For #74478 Change-Id: I902e9a92cdacb5ad6dafa9896640f8196ba1d56a Reviewed-on: https://go-review.googlesource.com/c/go/+/686115 LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Auto-Submit: Keith Randall Reviewed-by: Keith Randall Reviewed-by: Carlos Amedee --- diff --git a/src/cmd/compile/doc.go b/src/cmd/compile/doc.go index f76f402f38..81e6189a26 100644 --- a/src/cmd/compile/doc.go +++ b/src/cmd/compile/doc.go @@ -253,6 +253,9 @@ The //go:nosplit directive must be followed by a function declaration. It specifies that the function must omit its usual stack overflow check. This is most commonly used by low-level runtime code invoked at times when it is unsafe for the calling goroutine to be preempted. +Using this directive outside of low-level runtime code is not safe, +because it permits the nosplit function to overwrite the end of stack, +leading to memory corruption and arbitrary program failure. # Linkname Directive