mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
![Russ Cox](/assets/img/avatar_default.png)
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>
15 lines
224 B
Go
15 lines
224 B
Go
// +build amd64
|
|
// asmcheck -gcflags=-spectre=ret
|
|
|
|
package codegen
|
|
|
|
func CallFunc(f func()) {
|
|
// amd64:`CALL\truntime.retpoline`
|
|
f()
|
|
}
|
|
|
|
func CallInterface(x interface{ M() }) {
|
|
// amd64:`CALL\truntime.retpoline`
|
|
x.M()
|
|
}
|