[all-commits] [llvm/llvm-project] 21b25a: [libunwind] Support stack unwind in CET environment

jinge90 via All-commits all-commits at lists.llvm.org
Thu Aug 26 01:14:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 21b25a1fb32ecd2e1f336123c2715f8ef1a49f97
      https://github.com/llvm/llvm-project/commit/21b25a1fb32ecd2e1f336123c2715f8ef1a49f97
  Author: gejin <ge.jin at intel.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M libunwind/CMakeLists.txt
    M libunwind/src/CMakeLists.txt
    M libunwind/src/Registers.hpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindLevel1.c
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/UnwindRegistersSave.S
    M libunwind/src/assembly.h
    A libunwind/src/cet_unwind.h
    M libunwind/src/libunwind.cpp
    M libunwind/test/CMakeLists.txt
    M libunwind/test/libunwind/test/config.py
    M libunwind/test/lit.site.cfg.in

  Log Message:
  -----------
  [libunwind] Support stack unwind in CET environment

Control-flow Enforcement Technology (CET), published by Intel,
introduces shadow stack feature aiming to ensure a return from
a function is directed to where the function was called.
In a CET enabled system, each function call will push return
address into normal stack and shadow stack, when the function
returns, the address stored in shadow stack will be popped and
compared with the return address, program will fail if the 2
addresses don't match.
In exception handling, the control flow may skip some stack frames
and we must adjust shadow stack to avoid violating CET restriction.
In order to achieve this, we count the number of stack frames skipped
and adjust shadow stack by this number before jumping to landing pad.

Reviewed By: hjl.tools, compnerd, MaskRay
Differential Revision: https://reviews.llvm.org/D105968

Signed-off-by: gejin <ge.jin at intel.com>




More information about the All-commits mailing list