[all-commits] [llvm/llvm-project] 79b3f0: StackProtector: expose RequiresStackProtector publ...

Tim Northover via All-commits all-commits at lists.llvm.org
Thu Mar 16 04:34:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79b3f0823e562fc652c3272b2ccfb99174445fa6
      https://github.com/llvm/llvm-project/commit/79b3f0823e562fc652c3272b2ccfb99174445fa6
  Author: Tim Northover <tnorthover at apple.com>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/StackProtector.h
    M llvm/lib/CodeGen/StackProtector.cpp

  Log Message:
  -----------
  StackProtector: expose RequiresStackProtector publicly. NFC.


  Commit: 203b6f31bb71ce63488eb96b303e000e91aee376
      https://github.com/llvm/llvm-project/commit/203b6f31bb71ce63488eb96b303e000e91aee376
  Author: Tim Northover <tnorthover at apple.com>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M llvm/lib/CodeGen/DwarfEHPrepare.cpp
    A llvm/test/CodeGen/Generic/safestack-unwind.ll

  Log Message:
  -----------
  DwarfEHPrepare: insert extra unwind paths for stack protector to instrument

This is a mitigation patch for
https://bugs.chromium.org/p/llvm/issues/detail?id=30, where existing stack
protection is skipped if a function is returned through by an unwinder rather
than the normal call/return path. The recent patch D139254 added the ability to
instrument a visible unwind path, at least in the IR case (I'm working on the
SelectionDAG instrumentation too) but there are still invisible unwinds it
can't reach.

So this patch adds logic to DwarfEHPrepare that goes through a function,
converting any call that might throw into an invoke to a simple resume cleanup,
and adding cleanup clauses to existing landingpads that lack them. Obviously we
don't really want to do this if it's wasted effort, so I also exposed
requiresStackProtector from the actual StackProtector code to skip the extra
paths if they won't be used.

https://reviews.llvm.org/D143637


Compare: https://github.com/llvm/llvm-project/compare/8e009348e8a2...203b6f31bb71


More information about the All-commits mailing list