[llvm-bugs] [Bug 38249] New: compiler-rt: Mark REAL(swapcontext) with indirect_return attribute on x86

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 20 09:45:01 PDT 2018


            Bug ID: 38249
           Summary: compiler-rt: Mark REAL(swapcontext) with
                    indirect_return attribute on x86
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: kcc at google.com, llvm-bugs at lists.llvm.org

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)

I opened an LLVM bug:


to add the indirect_return attribute so that it can be used to inform
compiler to insert ENDBR after REAL(swapcontext) call.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180720/a845749a/attachment.html>

More information about the llvm-bugs mailing list