[all-commits] [llvm/llvm-project] 9ef536: [UBSan] Disable the function and kcfi sanitizers o...

MaggieYingYi via All-commits all-commits at lists.llvm.org
Wed Aug 30 09:20:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ef536a12ea65a2b9e2511936327c7b621af38fb
      https://github.com/llvm/llvm-project/commit/9ef536a12ea65a2b9e2511936327c7b621af38fb
  Author: Ying Yi <ying.yi at sony.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M clang/include/clang/Basic/Sanitizers.h
    M clang/lib/Basic/CMakeLists.txt
    M clang/lib/Basic/Sanitizers.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/test/CodeGenObjCXX/crash-function-type.mm
    M clang/test/Driver/fsanitize.c

  Log Message:
  -----------
  [UBSan] Disable the function and kcfi sanitizers on an execute-only target.

An execute-only target disallows data access to code sections.
-fsanitize=function and -fsanitize=kcfi instrument indirect function
calls to load a type hash before the function label. This results in a
non-execute access to the code section and a runtime error.

To solve the issue, -fsanitize=function should not be included in any
check group (e.g. undefined) on an execute-only target. If a user passes
-fsanitize=undefined, there is no error and no warning. However, if the
user explicitly passes -fsanitize=function or -fsanitize=kcfi on an
execute-only target, an error will be emitted.

Fixes: https://github.com/llvm/llvm-project/issues/64931.

Reviewed By: MaskRay, probinson, simon_tatham

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




More information about the All-commits mailing list