[PATCH] D135411: Add generic KCFI operand bundle lowering

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 15:41:37 PDT 2022


samitolvanen created this revision.
Herald added subscribers: Enna1, ormris, pengfei, hiraditya, kristof.beyls.
Herald added a project: All.
samitolvanen requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

The KCFI sanitizer emits "kcfi" operand bundles to indirect
call instructions, which the LLVM back-end lowers into an
architecture-specific type check with a known machine instruction
sequence. Currently, KCFI operand bundle lowering is supported only
on 64-bit X86 and AArch64 architectures.

As a lightweight forward-edge CFI implementation that doesn't
require LTO is also useful for non-Linux low-level targets on
other machine architectures, add a generic KCFI operand bundle
lowering pass that's only used when back-end lowering support is not
available and allows -fsanitize=kcfi to be enabled in Clang on all
architectures.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135411

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChain.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Instrumentation/KCFI.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/CMakeLists.txt
  llvm/lib/Transforms/Instrumentation/KCFI.cpp
  llvm/test/Transforms/KCFI/kcfi-patchable-function-prefix.ll
  llvm/test/Transforms/KCFI/kcfi-supported.ll
  llvm/test/Transforms/KCFI/kcfi.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135411.465914.patch
Type: text/x-patch
Size: 13963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221006/95f6c1e2/attachment.bin>


More information about the cfe-commits mailing list