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

xiongji90 via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 15 01:01:28 PDT 2021


xiongji90 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
----------------
hjl.tools wrote:
> 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.
Hi, @hjl.tools 
For 32bit mode, I have aligned with gcc unwind to use %ecx to store landing pad address then jump to it.
Thanks very much.


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

https://reviews.llvm.org/D105968



More information about the libcxx-commits mailing list