From: Jim Wilson <jimw@sifive.com>
To: Amir Naseredini <S.Naseredini@sussex.ac.uk>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Spectre mitigations in gcc compiler
Date: Wed, 11 Nov 2020 20:39:50 -0800 [thread overview]
Message-ID: <CAFyWVaaJHCMptR2FbQWhOef24w_18tWMGJCiWf2mLq_mt5PgTQ@mail.gmail.com> (raw)
In-Reply-To: <LO2P265MB0382BCE810C3402242D8CA94A4E90@LO2P265MB0382.GBRP265.PROD.OUTLOOK.COM>
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
prev parent reply other threads:[~2020-11-12 4:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 17:00 Amir Naseredini
2020-11-12 4:39 ` Jim Wilson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyWVaaJHCMptR2FbQWhOef24w_18tWMGJCiWf2mLq_mt5PgTQ@mail.gmail.com \
--to=jimw@sifive.com \
--cc=S.Naseredini@sussex.ac.uk \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).