1#
2# Copyright (C) 2023 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Enables more comprehensive detection of memory errors on hardware that
18# supports the ARM Memory Tagging Extension (MTE), by building the image with
19# MTE stack instrumentation and forcing MTE on in SYNC mode in all processes.
20# For more details, see:
21# https://source.android.com/docs/security/test/memory-safety/arm-mte
22ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
23  SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap memtag_stack)
24  SANITIZE_TARGET_DIAG := $(strip $(SANITIZE_TARGET_DIAG) memtag_heap)
25endif
26PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.default=sync
27PRODUCT_SCUDO_ALLOCATION_RING_BUFFER_SIZE := 131072
28