[all-commits] [llvm/llvm-project] b1e9ab: Add CFI integer types normalization

Ramon de C Valle via All-commits all-commits at lists.llvm.org
Wed Feb 1 09:48:22 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e
      https://github.com/llvm/llvm-project/commit/b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e
  Author: Ramon de C Valle <rcvalle at users.noreply.github.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M clang/docs/ControlFlowIntegrity.rst
    M clang/docs/UsersManual.rst
    M clang/include/clang/AST/Mangle.h
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Driver/SanitizerArgs.h
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    A clang/test/CodeGen/cfi-icall-normalize.c
    A clang/test/CodeGen/cfi-icall-normalize2.c
    A clang/test/CodeGen/kcfi-normalize.c

  Log Message:
  -----------
  Add CFI integer types normalization

This commit adds a new option (i.e.,
`-fsanitize-cfi-icall-normalize-integers`) for normalizing integer types
as vendor extended types for cross-language LLVM CFI/KCFI support with
other languages that can't represent and encode C/C++ integer types.

Specifically, integer types are encoded as their defined representations
(e.g., 8-bit signed integer, 16-bit signed integer, 32-bit signed
integer, ...) for compatibility with languages that define
explicitly-sized integer types (e.g., i8, i16, i32, ..., in Rust).

``-fsanitize-cfi-icall-normalize-integers`` is compatible with
``-fsanitize-cfi-icall-generalize-pointers``.

This helps with providing cross-language CFI support with the Rust
compiler and is an alternative solution for the issue described and
alternatives proposed in the RFC
https://github.com/rust-lang/rfcs/pull/3296.

For more information about LLVM CFI/KCFI and cross-language LLVM
CFI/KCFI support for the Rust compiler, see the design document in the
tracking issue https://github.com/rust-lang/rust/issues/89653.

Reviewed By: pcc, samitolvanen

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




More information about the All-commits mailing list