[PATCH] D105968: [libunwind][CET] Support exception handling stack unwind in CET environment

H.J Lu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 07:19:05 PDT 2021


hjl.tools added inline comments.


================
Comment at: libunwind/src/UnwindRegistersRestore.S:51
+  add    $4, %esp
+  jmp    *-4(%esp)  # use indirect jump instead of 'ret' to avoid pushing shadow stack
   # skip cs
----------------
xiongji90 wrote:
> hjl.tools wrote:
> > I don't think it is safe to access memory below stack pointer in 32-bit mode since there is no red zone.   Please check what
> > the GCC unwinder does.
> Hi, @hjl.tools 
> Before jumping to -4(%esp), we have added 4 to %esp value, so we should access a valid stack frame here.
> Before adding 4 to esp, it should point to memory location where jump target address resides.
> Thanks very much.
When an interrupt comes between "add $4, %esp" and "jmp -4(%esp)", the content at -4(%esp) can be changed by
the interrupt.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105968/new/

https://reviews.llvm.org/D105968



More information about the llvm-commits mailing list