Skip to content

Commit bb917bb

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent a5bda58 commit bb917bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cmd/compile/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ The //go:nosplit directive must be followed by a function declaration.
253253
It specifies that the function must omit its usual stack overflow check.
254254
This is most commonly used by low-level runtime code invoked
255255
at times when it is unsafe for the calling goroutine to be preempted.
256+
Using this directive outside of low-level runtime code is not safe,
257+
because it permits the nosplit function to overwrite the end of stack,
258+
leading to memory corruption and arbitrary program failure.
256259
257260
# Linkname Directive
258261

0 commit comments

Comments
 (0)