aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stubs_amd64.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-01-17 13:54:30 -0500
committerRuss Cox <rsc@golang.org>2020-03-13 19:05:54 +0000
commitfc8a6336d1ad29acf2c7728ce669df9059169132 (patch)
tree4121580d23be8c08aa0a7b0077254035ecb4473b /src/runtime/stubs_amd64.go
parent877ef86bec593cd7e40899ac5446791e65b47839 (diff)
downloadgo-fc8a6336d1ad29acf2c7728ce669df9059169132.tar.gz
go-fc8a6336d1ad29acf2c7728ce669df9059169132.zip
cmd/asm, cmd/compile, runtime: add -spectre=ret mode
This commit extends the -spectre flag to cmd/asm and adds a new Spectre mitigation mode "ret", which enables the use of retpolines. Retpolines prevent speculation about the target of an indirect jump or call and are described in more detail here: https://support.google.com/faqs/answer/7625886 Change-Id: I4f2cb982fa94e44d91e49bd98974fd125619c93a Reviewed-on: https://go-review.googlesource.com/c/go/+/222661 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/stubs_amd64.go')
-rw-r--r--src/runtime/stubs_amd64.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/stubs_amd64.go b/src/runtime/stubs_amd64.go
index b4c0df1153..5b79d66762 100644
--- a/src/runtime/stubs_amd64.go
+++ b/src/runtime/stubs_amd64.go
@@ -9,3 +9,20 @@ func stackcheck()
// Called from assembly only; declared for go vet.
func settls() // argument in DI
+
+// Retpolines, used by -spectre=ret flag in cmd/asm, cmd/compile.
+func retpolineAX()
+func retpolineCX()
+func retpolineDX()
+func retpolineBX()
+func retpolineBP()
+func retpolineSI()
+func retpolineDI()
+func retpolineR8()
+func retpolineR9()
+func retpolineR10()
+func retpolineR11()
+func retpolineR12()
+func retpolineR13()
+func retpolineR14()
+func retpolineR15()