diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2018-03-09 19:11:44 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2018-03-09 19:11:44 +0000 |
commit | ff2d057904474f978563112276df87143032421b (patch) | |
tree | c423ab26f63a27cf9f39a96b1c8a1c3eb3f5ed1e /test/cfi | |
parent | 0d7956335942ee1e32255e12d3b302c80ae5d021 (diff) |
Use branch funnels for virtual calls when retpoline mitigation is enabled.
The retpoline mitigation for variant 2 of CVE-2017-5715 inhibits the
branch predictor, and as a result it can lead to a measurable loss of
performance. We can reduce the performance impact of retpolined virtual
calls by replacing them with a special construct known as a branch
funnel, which is an instruction sequence that implements virtual calls
to a set of known targets using a binary tree of direct branches. This
allows the processor to speculately execute valid implementations of the
virtual function without allowing for speculative execution of of calls
to arbitrary addresses.
This patch extends the whole-program devirtualization pass to replace
certain virtual calls with calls to branch funnels, which are
represented using a new llvm.icall.jumptable intrinsic. It also extends
the LowerTypeTests pass to recognize the new intrinsic, generate code
for the branch funnels (x86_64 only for now) and lay out virtual tables
as required for each branch funnel.
The implementation supports full LTO as well as ThinLTO, and extends the
ThinLTO summary format used for whole-program devirtualization to
support branch funnels.
For more details see RFC:
http://lists.llvm.org/pipermail/llvm-dev/2018-January/120672.html
Differential Revision: https://reviews.llvm.org/D42453
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/cfi')
-rw-r--r-- | test/cfi/simple-pass.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/cfi/simple-pass.cpp b/test/cfi/simple-pass.cpp index aba09be2d..920922f37 100644 --- a/test/cfi/simple-pass.cpp +++ b/test/cfi/simple-pass.cpp @@ -1,5 +1,7 @@ // RUN: %clangxx_cfi -o %t %s // RUN: %run %t +// RUN: %clangxx_cfi -mretpoline -o %t2 %s +// RUN: %run %t2 // Tests that the CFI mechanism does not crash the program when making various // kinds of valid calls involving classes with various different linkages and |