mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
a5bda585d5
commit
bb917bb030
1 changed files with 3 additions and 0 deletions
|
|
@ -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.
|
It specifies that the function must omit its usual stack overflow check.
|
||||||
This is most commonly used by low-level runtime code invoked
|
This is most commonly used by low-level runtime code invoked
|
||||||
at times when it is unsafe for the calling goroutine to be preempted.
|
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
|
# Linkname Directive
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue