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 | 0cb55919eca72a89d2fcb29dd958631ee07a32fb (patch) | |
tree | 1343c66c1f98a10526503dfe70137050ee930b63 /llvm/tools/llvm-objcopy/llvm-objcopy.cpp | |
parent | eb50a2e8d4b6bde7a8b8d57995c274962aeb33e8 (diff) | |
download | bcm5719-llvm-0cb55919eca72a89d2fcb29dd958631ee07a32fb.tar.gz bcm5719-llvm-0cb55919eca72a89d2fcb29dd958631ee07a32fb.zip |
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
llvm-svn: 337603
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
0 files changed, 0 insertions, 0 deletions