[all-commits] [llvm/llvm-project] 8aa149: [MTE] Add -fsanitize=memtag* and friends.

Mitch Phillips via All-commits all-commits at lists.llvm.org
Fri Apr 8 12:13:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8aa1490513f111afd407d87c3f07d26f65c8a686
      https://github.com/llvm/llvm-project/commit/8aa1490513f111afd407d87c3f07d26f65c8a686
  Author: Mitch Phillips <31459023+hctim at users.noreply.github.com>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Basic/Features.def
    M clang/include/clang/Basic/Sanitizers.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Driver/SanitizerArgs.h
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/CodeGen/memtag-attr.cpp
    M clang/test/Driver/fsanitize.c
    A clang/test/Driver/memtag-ld.c
    A clang/test/Driver/memtag-stack.c
    R clang/test/Driver/memtag.c
    A clang/test/Lexer/has_feature_memtag.cpp
    R clang/test/Lexer/has_feature_memtag_sanitizer.cpp

  Log Message:
  -----------
  [MTE] Add -fsanitize=memtag* and friends.

Currently, enablement of heap MTE on Android is specified by an ELF note, which
signals to the linker to enable heap MTE. This change allows
-fsanitize=memtag-heap to synthesize these notes, rather than adding them
through the build system. We need to extend this feature to also signal the
linker to do special work for MTE globals (in future) and MTE stack (currently
implemented in the toolchain, but not implemented in the loader).

Current Android uses a non-backwards-compatible ELF note, called
".note.android.memtag". Stack MTE is an ABI break anyway, so we don't mind that
we won't be able to run executables with stack MTE on Android 11/12 devices.

The current expectation is to support the verbiage used by Android, in
that "SYNC" means MTE Synchronous mode, and "ASYNC" effectively means
"fast", using the Kernel auto-upgrade feature that allows
hardware-specific and core-specific configuration as to whether "ASYNC"
would end up being Asynchronous, Asymmetric, or Synchronous on that
particular core, whichever has a reasonable performance delta. Of
course, this is platform and loader-specific.

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




More information about the All-commits mailing list