From bc9e47d93b915a79305bacdce43084a773f63031 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Mon, 2 Dec 2024 14:40:36 -0800 Subject: [PATCH] Fix kasan logic The command line "kasan=off" should be unconditionally set when we're compiling for a normal (non-_fullmte) build. The current logic sets "kasan=off" for a normal ENG build only, which is insufficent. Test: _fullmte userdebug/eng: "sanitizer-status mte" shows MTE enabled. Test: _fullmte userdebug/eng: "kasan=off" IS NOT present in /proc/cmdline Test: !_fullmte userdebug: "sanitizer-status mte" shows MTE disabled. Test: !_fullmte eng: "sanitizer-status mte" shows MTE enabled Test: !_fullmte userdebug/eng: "kasan=off" IS present in /proc/cmdline Change-Id: Idd61747156daa135e919ce71fd63bfab1f4d9239 Bug: 381940217 Flag: EXEMPT bugfix --- BoardConfig-common.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 998bd5c..dfecf05 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -41,9 +41,15 @@ BOARD_KERNEL_CMDLINE += swiotlb=noforce BOARD_KERNEL_CMDLINE += disable_dma32=on BOARD_KERNEL_CMDLINE += sysctl.kernel.sched_pelt_multiplier=4 +# Normal (non-_fullmte) builds should disable kasan ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT))) -ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT))) BOARD_KERNEL_CMDLINE += kasan=off +endif + +# Enable a limited subset of MTE for "normal" (non-_fullmte) eng builds. +# Don't touch any settings for _fullmte builds. They are set somewhere else. +ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT))) +ifeq ($(TARGET_BUILD_VARIANT),eng) BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),) SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)