[all-commits] [llvm/llvm-project] af01f7: Default implicit function pointer conversions diag...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Aug 10 10:54:35 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: af01f717c48f0fd2481600ed6c00441763365b62
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-08-10 (Wed, 10 Aug 2022)

  Changed paths:
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler-minimal.c
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/signal-handler.c
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/test/CodeGen/attributes.c
    M clang/test/CodeGen/overloadable.c
    M clang/test/Sema/aarch64-svepcs.c
    M clang/test/Sema/aarch64-vpcs.c
    M clang/test/Sema/arm-cmse.c
    M clang/test/Sema/attr-nocf_check.c
    M clang/test/Sema/block-return.c
    M clang/test/Sema/c2x-func-prototype.c
    M clang/test/Sema/callingconv-ms_abi.c
    M clang/test/Sema/callingconv-sysv_abi.c
    M clang/test/Sema/callingconv.c
    M clang/test/Sema/incompatible-function-pointer-types.c
    M clang/test/Sema/initialize-noreturn.c
    M clang/test/Sema/noescape.c
    M clang/test/Sema/overloadable.c
    M clang/test/Sema/pass-object-size.c
    M clang/test/Sema/preserve-call-conv.c
    M clang/test/SemaObjC/comptypes-legal.m

  Log Message:
  Default implicit function pointer conversions diagnostic to be an error

Implicitly converting between incompatible function pointers in C is
currently a default-on warning (it is an error in C++). However, this
is very poor security posture. A mismatch in parameters or return
types, or a mismatch in calling conventions, etc can lead to
exploitable security vulnerabilities. Rather than allow this unsafe
practice with a warning, this patch strengthens the warning to be an
error (while still allowing users the ability to disable the error or
the warning entirely to ease migration). Users should either ensure the
signatures are correctly compatible or they should use an explicit cast
if they believe that's more reasonable.

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

More information about the All-commits mailing list