ANDROID: gki_defconfig: enable CONFIG_KASAN_HW_TAGS

Enable in-kernel MTE (Memory Tagging Extension) support via
CONFIG_KASAN_HW_TAGS=y. With this change in-kernel MTE will be
auto-enabled during boot on hardware that supports MTE.

Currently, in-kernel MTE is only supported for slab and page_alloc
allocations. Future changes might include support for vmalloc, stack,
and globals.

By default:

- MTE works in synchronous mode, which means that tag faults are be
  reported at the point of occurence.
- When a tag fault is detected, a report is printed into the kernel log.
  Only the first tag fault gets reported. No panic occurs unless either
  kasan.fault=panic or panic_on_warn is set.
- A report contains the accessed address and a stack trace. There are no
  alloc/free stack traces for the accessed page or slab object
  (as specified via CONFIG_CMDLINE).

These defaults can be overridden via command line parameters, see
Documentation/dev-tools/kasan.rst for details.

Using kasan=off command line parameter will turn in-kernel MTE off.

A performance impact of ~10% is expected, but there is no MTE-enabled
hardware yet to run benchmarks. A future change of integrating in-kernel
MTE with init_on_alloc/free might significantly bring down the perfomance
impact.

There is no performance impact when in-kernel MTE is disabled via command
line or when hardware without MTE support (pre-ARMv8.5) is in use. There
is still a side-effect of TTBR1 TBI (Top Byte Ignore) getting enabled.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Bug: 172318110
Change-Id: I3d7fe6d41f916553b0bcad6402d4e373a7cd75cd
This commit is contained in:
Andrey Konovalov
2021-02-05 20:10:23 +01:00
committed by Alistair Delva
parent dd3f538bf7
commit b3aad32467

View File

@@ -57,6 +57,8 @@ CONFIG_CP15_BARRIER_EMULATION=y
CONFIG_SETEND_EMULATION=y
CONFIG_RANDOMIZE_BASE=y
# CONFIG_RANDOMIZE_MODULE_REGION_FULL is not set
CONFIG_CMDLINE="kasan.stacktrace=off"
CONFIG_CMDLINE_EXTEND=y
# CONFIG_DMI is not set
CONFIG_PM_WAKELOCKS=y
CONFIG_PM_WAKELOCKS_LIMIT=0
@@ -600,6 +602,8 @@ CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_KASAN=y
CONFIG_KASAN_HW_TAGS=y
CONFIG_KFENCE=y
CONFIG_KFENCE_SAMPLE_INTERVAL=0
CONFIG_PANIC_ON_OOPS=y