Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: consider extending '-spectre' option to other architectures #38066
@rsc recently added a
My understanding is that these mitigations could be important when the Go program being compiled is something like a hypervisor or operating system that has access to data or functionality that guest programs should be restricted from accessing. I'm still in the process of getting my head round these changes and how they might apply to other CPU architectures but my understanding so far is that, to be totally safe, we should apply similar mitigations on other platforms unless there are hardware mitigations in place.
The new flag also has potential for cross-platform incompatibilities since currently, for example,
I personally am responsible for maintaining the s390x port. I think it would be straightforward to implement equivalent mitigations on s390x:
Does anyone have any thoughts on what we should do for other architectures, if anything?
Yeah, this is probably a good thing. Thanks @mundaym
As this is highly related to the microarchitecture detail of the CPUs, it is probably good to demonstrate the problem as a first step.
And I'd imagine the implementation detail will differ across architectures. For example, retpoline is highly coupled with how RET instruction is speculated on x86. On LR machines things will probably be different? I think it would be good to know the mitigations we plan to do for a given architecture. Are there a list of mitigations for the architecture, say, from a C compiler or other language project? Thanks.
Yeah, I have no idea how to go about testing this... Maybe that will come out of the amd64 work? I doubt any spectre tests will work reliably on the buildbots though!
Yeah, s390x can use expolines, but I don't know about other LR architectures.
I'll see what I can find, I haven't been following them that closely and have only just started looking into this today. If someone else has such a list handy for any architectures then please post it :)