From: "H.J. Lu" <hjl.tools@gmail.com>
To: Hongtao Liu <crazylht@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [GCC 11 PATCH 0/5] x86: Backport straight-line-speculation mitigation
Date: Wed, 16 Feb 2022 05:30:17 -0800 [thread overview]
Message-ID: <CAMe9rOp7r_iMKzP2nAy6OTNesi7z5Wf531BsMi+HWV1tdAANnQ@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bxpKf_aH66=rHvbYMeVb-oBKogiC_5BHO3ZNEo2mv=9NA@mail.gmail.com>
On Tue, Feb 15, 2022 at 10:52 PM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Tue, Feb 1, 2022 at 2:55 AM H.J. Lu via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > Backport -mindirect-branch-cs-prefix:
> >
> > commit 48a4ae26c225eb018ecb59f131e2c4fd4f3cf89a
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date: Wed Oct 27 06:27:15 2021 -0700
> >
> > x86: Add -mindirect-branch-cs-prefix
> >
> > Add -mindirect-branch-cs-prefix to add CS prefix to call and jmp to
> > indirect thunk with branch target in r8-r15 registers so that the call
> > and jmp instruction length is 6 bytes to allow them to be replaced with
> > "lfence; call *%r8-r15" or "lfence; jmp *%r8-r15" at run-time.
> >
> > commit 63738e176726d31953deb03f7e32cf8b760735ac
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date: Wed Oct 27 07:48:54 2021 -0700
> >
> > x86: Add -mharden-sls=[none|all|return|indirect-branch]
> >
> > Add -mharden-sls= to mitigate against straight line speculation (SLS)
> > for function return and indirect branch by adding an INT3 instruction
> > after function return and indirect branch.
> >
> > and followup commits to support Linux kernel commits:
> >
> > commit e463a09af2f0677b9485a7e8e4e70b396b2ffb6f
> > Author: Peter Zijlstra <peterz@infradead.org>
> > Date: Sat Dec 4 14:43:44 2021 +0100
> >
> > x86: Add straight-line-speculation mitigation
> >
> > commit 68cf4f2a72ef8786e6b7af6fd9a89f27ac0f520d
> > Author: Peter Zijlstra <peterz@infradead.org>
> > Date: Fri Nov 19 17:50:25 2021 +0100
> >
> > x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds
> >
> > H.J. Lu (5):
> > x86: Remove "%!" before ret
> > x86: Add -mharden-sls=[none|all|return|indirect-branch]
> > x86: Add -mindirect-branch-cs-prefix
> > x86: Rename -harden-sls=indirect-branch to -harden-sls=indirect-jmp
> > x86: Generate INT3 for __builtin_eh_return
> The patch LGTM.
I am pushing this patch set into GCC 11 branch.
Thanks.
> >
> > gcc/config/i386/i386-opts.h | 7 ++++
> > gcc/config/i386/i386.c | 38 +++++++++++++------
> > gcc/config/i386/i386.md | 2 +-
> > gcc/config/i386/i386.opt | 24 ++++++++++++
> > gcc/doc/invoke.texi | 18 ++++++++-
> > gcc/testsuite/gcc.target/i386/harden-sls-1.c | 14 +++++++
> > gcc/testsuite/gcc.target/i386/harden-sls-2.c | 14 +++++++
> > gcc/testsuite/gcc.target/i386/harden-sls-3.c | 14 +++++++
> > gcc/testsuite/gcc.target/i386/harden-sls-4.c | 16 ++++++++
> > gcc/testsuite/gcc.target/i386/harden-sls-5.c | 17 +++++++++
> > gcc/testsuite/gcc.target/i386/harden-sls-6.c | 18 +++++++++
> > .../i386/indirect-thunk-cs-prefix-1.c | 14 +++++++
> > .../i386/indirect-thunk-cs-prefix-2.c | 15 ++++++++
> > 13 files changed, 198 insertions(+), 13 deletions(-)
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-1.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-2.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-3.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-4.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-5.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/harden-sls-6.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-cs-prefix-1.c
> > create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-cs-prefix-2.c
> >
> > --
> > 2.34.1
> >
>
>
> --
> BR,
> Hongtao
--
H.J.
prev parent reply other threads:[~2022-02-16 13:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 18:55 H.J. Lu
2022-01-31 18:55 ` [GCC 11 PATCH 1/5] x86: Remove "%!" before ret H.J. Lu
2022-02-16 6:46 ` Hongtao Liu
2022-01-31 18:55 ` [GCC 11 PATCH 2/5] x86: Add -mharden-sls=[none|all|return|indirect-branch] H.J. Lu
2022-01-31 18:55 ` [GCC 11 PATCH 3/5] x86: Add -mindirect-branch-cs-prefix H.J. Lu
2022-01-31 18:55 ` [GCC 11 PATCH 4/5] x86: Rename -harden-sls=indirect-branch to -harden-sls=indirect-jmp H.J. Lu
2022-01-31 18:55 ` [GCC 11 PATCH 5/5] x86: Generate INT3 for __builtin_eh_return H.J. Lu
2022-02-01 7:21 ` [GCC 11 PATCH 0/5] x86: Backport straight-line-speculation mitigation Richard Biener
2022-02-01 16:59 ` H.J. Lu
2022-02-02 9:22 ` Richard Biener
2022-02-16 7:01 ` Hongtao Liu
2022-02-16 13:30 ` H.J. Lu [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=CAMe9rOp7r_iMKzP2nAy6OTNesi7z5Wf531BsMi+HWV1tdAANnQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@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).