public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Spectre mitigations in gcc compiler
@ 2020-11-10 17:00 Amir Naseredini
  2020-11-12  4:39 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Amir Naseredini @ 2020-11-10 17:00 UTC (permalink / raw)
  To: gcc-help

Hello,

I was looking over the internet and am a bit confused about the mitigations that are provided by the gcc compiler for different variants of Spectre attack. So, I was wondering if there are any mitigations implemented for Specter v1 (Spectre-PHT), v2 (Spectre-BTB), v4 (Spectre-STL) and v5 (Spectre-RSB) at the compiler level for gcc?
Looking forward to hearing from you.

Warm regards,
Amir


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Spectre mitigations in gcc compiler
  2020-11-10 17:00 Spectre mitigations in gcc compiler Amir Naseredini
@ 2020-11-12  4:39 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2020-11-12  4:39 UTC (permalink / raw)
  To: Amir Naseredini; +Cc: gcc-help

On Tue, Nov 10, 2020 at 9:00 AM Amir Naseredini via Gcc-help <
gcc-help@gcc.gnu.org> wrote:

> I was looking over the internet and am a bit confused about the
> mitigations that are provided by the gcc compiler for different variants of
> Spectre attack. So, I was wondering if there are any mitigations
> implemented for Specter v1 (Spectre-PHT), v2 (Spectre-BTB), v4
> (Spectre-STL) and v5 (Spectre-RSB) at the compiler level for gcc?
> Looking forward to hearing from you.
>

We have a builtin function __builtin_speculation_safe_value that you can
use to protect from some of these attacks.  Support varies depending on the
target, but most of the popular targets will emit a special instruction
sequence when this is used.  The docs are in this page

https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Other-Builtins.html#Other-Builtins
about 1/5 of the way down.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-12  4:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 17:00 Spectre mitigations in gcc compiler Amir Naseredini
2020-11-12  4:39 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).