Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9afc20f1 authored by Mitch Phillips's avatar Mitch Phillips
Browse files

Merge "[MTE] [gnu make] Add memtag_globals as a sanitizer target." am:...

Merge "[MTE] [gnu make] Add memtag_globals as a sanitizer target." am: 61ce7afb am: 49211348 am: c6076a3b

Original change: https://android-review.googlesource.com/c/platform/build/+/2625936



Bug: b/288828741

 1. There was a topic that contained this build system glue, and a dependent change in external/cronet.
 2. external/cronet is setup to automerge into udc-mainline-prod from aosp.
 3. The build system isn't.
 4. Boom because of the missing dependency.

The build system glue should be low-risk, and I'd like to unbrick the build, and so merging this here on the desires of the cronet team. Follow ups to come in that bug.

Change-Id: I3ab9dd553e2d83c5cffbf0744f9c298b1ce766db
Merged-In: I44c239ba907a90a355c46e12afbbbe96bb2e4426
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
(cherry picked from commit c77b68f3)
parent 3d1f0791
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ endif
ifneq ($(filter address,$(my_sanitize)),)
  my_sanitize := $(filter-out cfi,$(my_sanitize))
  my_sanitize := $(filter-out memtag_stack,$(my_sanitize))
  my_sanitize := $(filter-out memtag_globals,$(my_sanitize))
  my_sanitize := $(filter-out memtag_heap,$(my_sanitize))
  my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
endif
@@ -183,8 +184,8 @@ endif
# Disable memtag for host targets. Host executables in AndroidMk files are
# deprecated, but some partners still have them floating around.
ifdef LOCAL_IS_HOST_MODULE
  my_sanitize := $(filter-out memtag_heap memtag_stack,$(my_sanitize))
  my_sanitize_diag := $(filter-out memtag_heap memtag_stack,$(my_sanitize_diag))
  my_sanitize := $(filter-out memtag_heap memtag_stack memtag_globals,$(my_sanitize))
  my_sanitize_diag := $(filter-out memtag_heap memtag_stack memtag_globals,$(my_sanitize_diag))
endif

# Disable sanitizers which need the UBSan runtime for host targets.
@@ -219,11 +220,13 @@ ifneq ($(filter arm x86 x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
  my_sanitize := $(filter-out hwaddress,$(my_sanitize))
  my_sanitize := $(filter-out memtag_heap,$(my_sanitize))
  my_sanitize := $(filter-out memtag_stack,$(my_sanitize))
  my_sanitize := $(filter-out memtag_globals,$(my_sanitize))
endif

ifneq ($(filter hwaddress,$(my_sanitize)),)
  my_sanitize := $(filter-out address,$(my_sanitize))
  my_sanitize := $(filter-out memtag_stack,$(my_sanitize))
  my_sanitize := $(filter-out memtag_globals,$(my_sanitize))
  my_sanitize := $(filter-out memtag_heap,$(my_sanitize))
  my_sanitize := $(filter-out thread,$(my_sanitize))
  my_sanitize := $(filter-out cfi,$(my_sanitize))
@@ -240,7 +243,7 @@ ifneq ($(filter hwaddress,$(my_sanitize)),)
  endif
endif

ifneq ($(filter memtag_heap memtag_stack,$(my_sanitize)),)
ifneq ($(filter memtag_heap memtag_stack memtag_globals,$(my_sanitize)),)
  ifneq ($(filter memtag_heap,$(my_sanitize_diag)),)
    my_cflags += -fsanitize-memtag-mode=sync
    my_sanitize_diag := $(filter-out memtag_heap,$(my_sanitize_diag))
@@ -269,6 +272,14 @@ ifneq ($(filter memtag_stack,$(my_sanitize)),)
  my_sanitize := $(filter-out memtag_stack,$(my_sanitize))
endif

ifneq ($(filter memtag_globals,$(my_sanitize)),)
  my_cflags += -fsanitize=memtag-globals
  # TODO(mitchp): For now, enable memtag-heap with memtag-globals because the
  # linker isn't new enough
  # (https://reviews.llvm.org/differential/changeset/?ref=4243566).
  my_sanitize := $(filter-out memtag_globals,$(my_sanitize))
endif

# TSAN is not supported on 32-bit architectures. For non-multilib cases, make
# its use an error. For multilib cases, don't use it for the 32-bit case.
ifneq ($(filter thread,$(my_sanitize)),)