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

H.J Lu via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 14 05:23:09 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
----------------
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.


================
Comment at: libunwind/src/UnwindRegistersRestore.S:126
+  addq   $8, %rsp
+  jmpq  *-8(%rsp)
 
----------------
It is OK to access memory below stack pointer in 64-bit mode since there is a red zone.


================
Comment at: libunwind/src/cet_unwind.h:28
+      else {                                                                   \
+        unsigned int iters = (x) / 255;                                        \
+        unsigned int rem = (x) % 255;                                          \
----------------
Why are / and % used here?  You pop 255 frames a time if numbers of frame > 255.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105968



More information about the libcxx-commits mailing list