Skip to content

Commit e8e8c5c

Browse files
author
Zola Bridges
committed
Revert "[clang][slh] add attribute for speculative load hardening"
This reverts commit 801eaf9. llvm-svn: 347588
1 parent 4ed350d commit e8e8c5c

File tree

8 files changed

+13
-107
lines changed

8 files changed

+13
-107
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,9 +3091,3 @@ def AlwaysDestroy : InheritableAttr {
30913091
let Subjects = SubjectList<[Var]>;
30923092
let Documentation = [AlwaysDestroyDocs];
30933093
}
3094-
3095-
def SpeculativeLoadHardening : InheritableAttr {
3096-
let Spellings = [Clang<"speculative_load_hardening">];
3097-
let Subjects = SubjectList<[Function, ObjCMethod], ErrorDiag>;
3098-
let Documentation = [SpeculativeLoadHardeningDocs];
3099-
}

clang/include/clang/Basic/AttrDocs.td

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3629,27 +3629,3 @@ GNU inline semantics are the default behavior with ``-std=gnu89``,
36293629
``-std=c89``, ``-std=c94``, or ``-fgnu89-inline``.
36303630
}];
36313631
}
3632-
3633-
def SpeculativeLoadHardeningDocs : Documentation {
3634-
let Category = DocCatFunction;
3635-
let Content = [{
3636-
This attribute can be applied to a function declaration in order to indicate
3637-
that `Speculative Load Hardening <https://llvm.org/docs/SpeculativeLoadHardening.html>`_
3638-
should be enabled for the function body. This can also be applied to a method
3639-
in Objective C.
3640-
3641-
Speculative Load Hardening is a best-effort mitigation against
3642-
information leak attacks that make use of control flow
3643-
miss-speculation - specifically miss-speculation of whether a branch
3644-
is taken or not. Typically vulnerabilities enabling such attacks are
3645-
classified as "Spectre variant #1". Notably, this does not attempt to
3646-
mitigate against miss-speculation of branch target, classified as
3647-
"Spectre variant #2" vulnerabilities.
3648-
3649-
When inlining, the attribute is sticky. Inlining a function that
3650-
carries this attribute will cause the caller to gain the
3651-
attribute. This is intended to provide a maximally conservative model
3652-
where the code in a function annotated with this attribute will always
3653-
(even after inlining) end up hardened.
3654-
}];
3655-
}

clang/lib/CodeGen/CGCall.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,6 @@ void CodeGenModule::ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
17911791
if (CodeGenOpts.Backchain)
17921792
FuncAttrs.addAttribute("backchain");
17931793

1794-
// FIXME: The interaction of this attribute with the SLH command line flag
1795-
// has not been determined.
17961794
if (CodeGenOpts.SpeculativeLoadHardening)
17971795
FuncAttrs.addAttribute(llvm::Attribute::SpeculativeLoadHardening);
17981796
}
@@ -1856,8 +1854,6 @@ void CodeGenModule::ConstructAttributeList(
18561854
FuncAttrs.addAttribute(llvm::Attribute::NoDuplicate);
18571855
if (TargetDecl->hasAttr<ConvergentAttr>())
18581856
FuncAttrs.addAttribute(llvm::Attribute::Convergent);
1859-
if (TargetDecl->hasAttr<SpeculativeLoadHardeningAttr>())
1860-
FuncAttrs.addAttribute(llvm::Attribute::SpeculativeLoadHardening);
18611857

18621858
if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
18631859
AddAttributesFromFunctionProtoType(

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6373,9 +6373,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
63736373
case ParsedAttr::AT_Section:
63746374
handleSectionAttr(S, D, AL);
63756375
break;
6376-
case ParsedAttr::AT_SpeculativeLoadHardening:
6377-
handleSimpleAttribute<SpeculativeLoadHardeningAttr>(S, D, AL);
6378-
break;
63796376
case ParsedAttr::AT_CodeSeg:
63806377
handleCodeSegAttr(S, D, AL);
63816378
break;

clang/test/CodeGen/attr-speculative-load-hardening.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

clang/test/CodeGen/attr-speculative-load-hardening.m

Lines changed: 0 additions & 9 deletions
This file was deleted.

clang/test/SemaCXX/attr-speculative-load-hardening.cpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

llvm/docs/LangRef.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,15 +1643,19 @@ example:
16431643
``speculative_load_hardening``
16441644
This attribute indicates that
16451645
`Speculative Load Hardening <https://llvm.org/docs/SpeculativeLoadHardening.html>`_
1646-
should be enabled for the function body.
1647-
1648-
Speculative Load Hardening is a best-effort mitigation against
1649-
information leak attacks that make use of control flow
1650-
miss-speculation - specifically miss-speculation of whether a branch
1651-
is taken or not. Typically vulnerabilities enabling such attacks are
1652-
classified as "Spectre variant #1". Notably, this does not attempt to
1653-
mitigate against miss-speculation of branch target, classified as
1654-
"Spectre variant #2" vulnerabilities.
1646+
should be enabled for the function body. This is a best-effort attempt to
1647+
mitigate all known speculative execution information leak vulnerabilities
1648+
that are based on the fundamental principles of modern processors'
1649+
speculative execution. These vulnerabilities are classified as "Spectre
1650+
variant #1" vulnerabilities typically. Notably, this does not attempt to
1651+
mitigate any vulnerabilities where the speculative execution and/or
1652+
prediction devices of specific processors can be *completely* undermined
1653+
(such as "Branch Target Injection", a.k.a, "Spectre variant #2"). Instead,
1654+
this is a target-independent request to harden against the completely
1655+
generic risk posed by speculative execution to incorrectly load secret data,
1656+
making it available to some micro-architectural side-channel for information
1657+
leak. For a processor without any speculative execution or predictors, this
1658+
is expected to be a no-op.
16551659

16561660
When inlining, the attribute is sticky. Inlining a function that carries
16571661
this attribute will cause the caller to gain the attribute. This is intended

0 commit comments

Comments
 (0)