[all-commits] [llvm/llvm-project] cacd3e: Add generic KCFI operand bundle lowering

Sami Tolvanen via All-commits all-commits at lists.llvm.org
Tue Nov 22 15:01:39 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cacd3e73d7f87ef3593443271ab3f170d0360934
      https://github.com/llvm/llvm-project/commit/cacd3e73d7f87ef3593443271ab3f170d0360934
  Author: Sami Tolvanen <samitolvanen at google.com>
  Date:   2022-11-22 (Tue, 22 Nov 2022)

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

  Log Message:
  -----------
  Add generic KCFI operand bundle lowering

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.

This relands commit eb2a57ebc7aaad551af30462097a9e06c96db925 with
fixes.

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D135411




More information about the All-commits mailing list