[all-commits] [llvm/llvm-project] b194cf: [clang] Function type attribute to prevent CFI ins...

PiJoules via All-commits all-commits at lists.llvm.org
Wed Jun 4 11:19:48 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b194cf1e401a9c7293c1e9b7d30008fad6b53ede
      https://github.com/llvm/llvm-project/commit/b194cf1e401a9c7293c1e9b7d30008fad6b53ede
  Author: PiJoules <6019989+PiJoules at users.noreply.github.com>
  Date:   2025-06-04 (Wed, 04 Jun 2025)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/include/clang/AST/TypeProperties.td
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/CodeGen/CGPointerAuth.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaType.cpp
    A clang/test/CodeGen/cfi-unchecked-callee-attribute-member-function.cpp
    A clang/test/CodeGen/cfi-unchecked-callee-attribute.cpp
    A clang/test/Frontend/cfi-unchecked-callee-attribute-n3037.c
    A clang/test/Frontend/cfi-unchecked-callee-attribute.c
    A clang/test/Frontend/cfi-unchecked-callee-attribute.cpp

  Log Message:
  -----------
  [clang] Function type attribute to prevent CFI instrumentation (#135836)

This introduces the attribute discussed in

https://discourse.llvm.org/t/rfc-function-type-attribute-to-prevent-cfi-instrumentation/85458.

The proposed name has been changed from `no_cfi` to
`cfi_unchecked_callee` to help differentiate from `no_sanitize("cfi")`
more easily. The proposed attribute has the following semantics:

1. Indirect calls to a function type with this attribute will not be
instrumented with CFI. That is, the indirect call will not be checked.
Note that this only changes the behavior for indirect calls on pointers
to function types having this attribute. It does not prevent all
indirect function calls for a given type from being checked.
2. All direct references to a function whose type has this attribute
will always reference the true function definition rather than an entry
in the CFI jump table.
3. When a pointer to a function with this attribute is implicitly cast
to a pointer to a function without this attribute, the compiler will
give a warning saying this attribute is discarded. This warning can be
silenced with an explicit C-style cast or C++ static_cast.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list