diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-07-20 19:24:11 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-07-20 19:24:11 +0000 |
commit | c3554027940f5d19133a3a335e5ef667d3a251e2 (patch) | |
tree | b587957f1e2d2b09d71fb194986085c70aa31183 /test/cfi | |
parent | 517b6132810b6ceb8ea6d45174d8986e1b023461 (diff) |
Mark REAL(swapcontext) with indirect_return attribute on x86
When shadow stack from Intel CET is enabled, the first instruction of all
indirect branch targets must be a special instruction, ENDBR.
lib/asan/asan_interceptors.cc has
...
int res = REAL(swapcontext)(oucp, ucp);
...
REAL(swapcontext) is a function pointer to swapcontext in libc. Since
swapcontext may return via indirect branch on x86 when shadow stack is
enabled, as in this case,
int res = REAL(swapcontext)(oucp, ucp);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This function may be
returned via an indirect branch.
Here compiler must insert ENDBR after call, like
call *bar(%rip)
endbr64
I opened an LLVM bug:
https://bugs.llvm.org/show_bug.cgi?id=38207
to add the indirect_return attribute so that it can be used to inform
compiler to insert ENDBR after REAL(swapcontext) call. We mark
REAL(swapcontext) with the indirect_return attribute if it is available.
This fixed:
https://bugs.llvm.org/show_bug.cgi?id=38249
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D49608
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337603 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/cfi')
0 files changed, 0 insertions, 0 deletions