From 7463e548bfd02feedfc6f0aa68920c8e50212615 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Mon, 2 Dec 2024 16:47:23 -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 e2e323cf..a1ff9d9a 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -39,9 +39,15 @@ BOARD_KERNEL_CMDLINE += swiotlb=1024 BOARD_KERNEL_CMDLINE += cgroup.memory=nokmem 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)