This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 0/5] x86: CVE-2017-5715, aka Spectre
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 7 Jan 2018 14:58:59 -0800
- Subject: [PATCH 0/5] x86: CVE-2017-5715, aka Spectre
- Authentication-results: sourceware.org; auth=none
This set of patches for GCC 8 mitigates variant #2 of the speculative execution
vulnerabilities on x86 processors identified by CVE-2017-5715, aka Spectre. They
convert indirect branches to call and return thunks to avoid speculative execution
via indirect call and jmp.
H.J. Lu (5):
x86: Add -mindirect-branch=
x86: Add -mindirect-branch-loop=
x86: Add -mfunction-return=
x86: Add -mindirect-branch-register
x86: Add 'V' register operand modifier
gcc/config/i386/constraints.md | 12 +-
gcc/config/i386/i386-opts.h | 14 +
gcc/config/i386/i386-protos.h | 2 +
gcc/config/i386/i386.c | 655 ++++++++++++++++++++-
gcc/config/i386/i386.h | 10 +
gcc/config/i386/i386.md | 51 +-
gcc/config/i386/i386.opt | 45 ++
gcc/config/i386/predicates.md | 21 +-
gcc/doc/extend.texi | 22 +
gcc/doc/invoke.texi | 37 +-
gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 19 +
gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 19 +
gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 20 +
gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 20 +
gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 16 +
gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 17 +
gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 43 ++
.../gcc.target/i386/indirect-thunk-attr-1.c | 22 +
.../gcc.target/i386/indirect-thunk-attr-2.c | 20 +
.../gcc.target/i386/indirect-thunk-attr-3.c | 21 +
.../gcc.target/i386/indirect-thunk-attr-4.c | 20 +
.../gcc.target/i386/indirect-thunk-attr-5.c | 22 +
.../gcc.target/i386/indirect-thunk-attr-6.c | 21 +
.../gcc.target/i386/indirect-thunk-attr-7.c | 44 ++
.../gcc.target/i386/indirect-thunk-attr-8.c | 41 ++
.../gcc.target/i386/indirect-thunk-bnd-1.c | 19 +
.../gcc.target/i386/indirect-thunk-bnd-2.c | 20 +
.../gcc.target/i386/indirect-thunk-bnd-3.c | 18 +
.../gcc.target/i386/indirect-thunk-bnd-4.c | 19 +
.../gcc.target/i386/indirect-thunk-extern-1.c | 19 +
.../gcc.target/i386/indirect-thunk-extern-2.c | 19 +
.../gcc.target/i386/indirect-thunk-extern-3.c | 20 +
.../gcc.target/i386/indirect-thunk-extern-4.c | 20 +
.../gcc.target/i386/indirect-thunk-extern-5.c | 16 +
.../gcc.target/i386/indirect-thunk-extern-6.c | 17 +
.../gcc.target/i386/indirect-thunk-extern-7.c | 43 ++
.../gcc.target/i386/indirect-thunk-inline-1.c | 18 +
.../gcc.target/i386/indirect-thunk-inline-2.c | 18 +
.../gcc.target/i386/indirect-thunk-inline-3.c | 19 +
.../gcc.target/i386/indirect-thunk-inline-4.c | 19 +
.../gcc.target/i386/indirect-thunk-inline-5.c | 15 +
.../gcc.target/i386/indirect-thunk-inline-6.c | 16 +
.../gcc.target/i386/indirect-thunk-inline-7.c | 42 ++
.../gcc.target/i386/indirect-thunk-loop-1.c | 19 +
.../gcc.target/i386/indirect-thunk-loop-2.c | 19 +
.../gcc.target/i386/indirect-thunk-loop-3.c | 19 +
.../gcc.target/i386/indirect-thunk-loop-4.c | 19 +
.../gcc.target/i386/indirect-thunk-loop-5.c | 19 +
.../gcc.target/i386/indirect-thunk-register-1.c | 22 +
.../gcc.target/i386/indirect-thunk-register-2.c | 20 +
.../gcc.target/i386/indirect-thunk-register-3.c | 19 +
.../gcc.target/i386/indirect-thunk-register-4.c | 13 +
gcc/testsuite/gcc.target/i386/ret-thunk-1.c | 12 +
gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 22 +
gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 22 +
gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 21 +
gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 21 +
gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 21 +
gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 21 +
gcc/testsuite/gcc.target/i386/ret-thunk-16.c | 18 +
gcc/testsuite/gcc.target/i386/ret-thunk-2.c | 12 +
gcc/testsuite/gcc.target/i386/ret-thunk-3.c | 12 +
gcc/testsuite/gcc.target/i386/ret-thunk-4.c | 12 +
gcc/testsuite/gcc.target/i386/ret-thunk-5.c | 14 +
gcc/testsuite/gcc.target/i386/ret-thunk-6.c | 13 +
gcc/testsuite/gcc.target/i386/ret-thunk-7.c | 13 +
gcc/testsuite/gcc.target/i386/ret-thunk-8.c | 14 +
gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 23 +
68 files changed, 2004 insertions(+), 47 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-loop-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-loop-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-loop-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-loop-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-loop-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-10.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-11.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-12.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-13.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-14.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-15.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-16.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-3.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-4.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-5.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-6.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-7.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-8.c
create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-9.c
--
2.14.3