summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorZhen XIN <zhen.xin@nokia-sbell.com>2023-07-04 09:44:01 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2023-08-10 23:09:37 +0200
commitd2af5ab850ce673e2c00cefd07727b9206904af3 (patch)
treea786cd1d3da37ac0896b0822ca099d89449e7616 /config
parent5e6bab661a1028d583338c5823f6a3b9d6444ce0 (diff)
downloadopenwrt-d2af5ab850ce673e2c00cefd07727b9206904af3.tar.gz
openwrt-d2af5ab850ce673e2c00cefd07727b9206904af3.tar.bz2
openwrt-d2af5ab850ce673e2c00cefd07727b9206904af3.zip
build: Add option KERNEL_KASAN_SW_TAGS and HW_TAGS
Currently KASAN is supported but only the generic one. SW-tag and HW-tag based KASAN have less impact on memory footprint or performance, and are worth supporting. Add choice menu for software and hardware Tag-Based KASAN, in addition to the generic one. Signed-off-by: Zhen XIN <zhen.xin@nokia-sbell.com> [Restructure commit message] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'config')
-rw-r--r--config/Config-kernel.in65
1 files changed, 61 insertions, 4 deletions
diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 76b0395f37..0c9e00d11f 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -184,16 +184,73 @@ config KERNEL_KASAN_VMALLOC
will have no effect.
if KERNEL_KASAN
- config KERNEL_KASAN_GENERIC
- def_bool y
+choice
+ prompt "KASAN mode"
+ depends on KERNEL_KASAN
+ default KERNEL_KASAN_GENERIC
+ help
+ KASAN has three modes:
+
+ 1. Generic KASAN (supported by many architectures, enabled with
+ CONFIG_KASAN_GENERIC, similar to userspace ASan),
+ 2. Software Tag-Based KASAN (arm64 only, based on software memory
+ tagging, enabled with CONFIG_KASAN_SW_TAGS, similar to userspace
+ HWASan), and
+ 3. Hardware Tag-Based KASAN (arm64 only, based on hardware memory
+ tagging, enabled with CONFIG_KASAN_HW_TAGS).
+
+config KERNEL_KASAN_GENERIC
+ bool "Generic KASAN"
+ select KERNEL_SLUB_DEBUG
+ help
+ Enables Generic KASAN.
+
+ Consumes about 1/8th of available memory at kernel start and adds an
+ overhead of ~50% for dynamic allocations.
+ The performance slowdown is ~x3.
+
+config KERNEL_KASAN_SW_TAGS
+ bool "Software Tag-Based KASAN"
+ depends on aarch64
+ select KERNEL_SLUB_DEBUG
+ help
+ Enables Software Tag-Based KASAN.
+
+ Supported only on arm64 CPUs and relies on Top Byte Ignore.
+
+ Consumes about 1/16th of available memory at kernel start and
+ add an overhead of ~20% for dynamic allocations.
+
+ May potentially introduce problems related to pointer casting and
+ comparison, as it embeds a tag into the top byte of each pointer.
+
+config KERNEL_KASAN_HW_TAGS
+ bool "Hardware Tag-Based KASAN"
+ depends on aarch64
+ select KERNEL_SLUB_DEBUG
+ select KERNEL_ARM64_MTE
+ help
+ Enables Hardware Tag-Based KASAN.
+
+ Supported only on arm64 CPUs starting from ARMv8.5 and relies on
+ Memory Tagging Extension and Top Byte Ignore.
+
+ Consumes about 1/32nd of available memory.
+
+ May potentially introduce problems related to pointer casting and
+ comparison, as it embeds a tag into the top byte of each pointer.
+
+endchoice
+
+ config KERNEL_ARM64_MTE
+ def_bool n
- config KERNEL_KASAN_SW_TAGS
- def_bool n
endif
choice
prompt "Instrumentation type"
depends on KERNEL_KASAN
+ depends on !KERNEL_KASAN_HW_TAGS
default KERNEL_KASAN_OUTLINE
config KERNEL_KASAN_OUTLINE