You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
This attribute will allow users to opt specific functions out of
speculative load hardening. This compliments the Clang attribute
named speculative_load_hardening. When this attribute or the attribute
speculative_load_hardening is used in combination with the flags
-mno-speculative-load-hardening or -mspeculative-load-hardening,
the function level attribute will override the default during LLVM IR
generation. For example, in the case, where the flag opposes the
function attribute, the function attribute will take precendence.
The sticky inlining behavior of the speculative_load_hardening attribute
may cause a function with the no_speculative_load_hardening attribute
to be tagged with the speculative_load_hardening tag in
subsequent compiler phases which is desired behavior since the
speculative_load_hardening LLVM attribute is designed to be maximally
conservative.
If both attributes are specified for a function, then an error will be
thrown.
Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54909
llvm-svn: 351565
This attribute can be applied to a function declaration in order to indicate
3823
3823
that `Speculative Load Hardening <https://llvm.org/docs/SpeculativeLoadHardening.html>`_
3824
3824
should be enabled for the function body. This can also be applied to a method
3825
-
in Objective C.
3825
+
in Objective C. This attribute will take precedence over the command line flag in
3826
+
the case where `-mno-speculative-load-hardening <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mspeculative-load-hardening>`_ is specified.
3826
3827
3827
3828
Speculative Load Hardening is a best-effort mitigation against
3828
3829
information leak attacks that make use of control flow
This attribute can be applied to a function declaration in order to indicate
3848
+
that `Speculative Load Hardening <https://llvm.org/docs/SpeculativeLoadHardening.html>`_
3849
+
is *not* needed for the function body. This can also be applied to a method
3850
+
in Objective C. This attribute will take precedence over the command line flag in
3851
+
the case where `-mspeculative-load-hardening <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mspeculative-load-hardening>`_ is specified.
3852
+
3853
+
Warning: This attribute may not prevent Speculative Load Hardening from being
3854
+
enabled for a function which inlines a function that has the
3855
+
'speculative_load_hardening' attribute. This is intended to provide a
3856
+
maximally conservative model where the code that is marked with the
3857
+
'speculative_load_hardening' attribute will always (even when inlined)
3858
+
be hardened. A user of this attribute may want to mark functions called by
3859
+
a function they do not want to be hardened with the 'noinline' attribute.
3860
+
3861
+
For example:
3862
+
3863
+
.. code-block:: c
3864
+
3865
+
__attribute__((speculative_load_hardening))
3866
+
int foo(int i) {
3867
+
return i;
3868
+
}
3869
+
3870
+
// Note: bar() may still have speculative load hardening enabled if
3871
+
// foo() is inlined into bar(). Mark foo() with __attribute__((noinline))
0 commit comments