This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add command-line option for SSBS
ClosedPublic

Authored by pbarrio on Nov 16 2018, 5:20 AM.

Details

Summary

SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds a command
line option to enable SSBS, as it was previously only possible to
enable by selecting -march=armv8.5-a.

Similar patch upstream in GNU binutils:
https://sourceware.org/ml/binutils/2018-09/msg00274.html

Diff Detail

Event Timeline

pbarrio created this revision.Nov 16 2018, 5:20 AM
samparker added a comment.EditedNov 23 2018, 2:23 AM

Hi Pablo,

Pardon my ignorance, but what's the interaction between the 'spec restrict' feature and ssbs? I see they both exist but in a couple of cases, FeaturesSSBS has replaced FeatureSpecRestrict. Also, is there a matching patch for clang?

Thank you for the review, Sam :)

FeatureSpecRestrict was really enabling two features, not one, both related to speculation restriction in the CPU. These features were the Software Context Number registers (SCXTNUM_ELx) and the Speculative Store Bypass Safe (SSBS) bit. We just added them into the same back-end feature initially because they are mandatory in 8.5 (i.e. no command line option required in 8.5). However, these security features are optional down to 8.0, so we want to allow them separately via a command-line option. This patch just spawns SSBS out of SpecRestrict.

Good point about the Clang patch. No changes inside clang itself (it picks up everything from tablegen directly) but I've added some testing. Now available for review at https://reviews.llvm.org/D54961. Feel free to point out there if I missed something.

samparker accepted this revision.Nov 28 2018, 3:43 AM

Thanks for the explanation, LGTM!

This revision is now accepted and ready to land.Nov 28 2018, 3:43 AM
pbarrio updated this revision to Diff 176383.Dec 3 2018, 5:58 AM

Rebased onto master after a recent refactoring of the AArch64 target parser.

This revision was automatically updated to reflect the committed changes.