path: root/mm/kasan
diff options
authorAndrey Konovalov <>2021-02-09 13:42:03 -0800
committerLinus Torvalds <>2021-02-09 17:26:44 -0800
commit1cc4cdb521f9689183474bc89eefc451ac44fa1c (patch)
tree1b6fad4426474239dc6a16aceaf00f516e6193d7 /mm/kasan
parent506220d2ba21791314af569211ffd8870b8208fa (diff)
kasan: fix stack traces dependency for HW_TAGS
Currently, whether the alloc/free stack traces collection is enabled by default for hardware tag-based KASAN depends on CONFIG_DEBUG_KERNEL. The intention for this dependency was to only enable collection on slow debug kernels due to a significant perf and memory impact. As it turns out, CONFIG_DEBUG_KERNEL is not considered a debug option and is enabled on many productions kernels including Android and Ubuntu. As the result, this dependency is pointless and only complicates the code and documentation. Having stack traces collection disabled by default would make the hardware mode work differently to to the software ones, which is confusing. This change removes the dependency and enables stack traces collection by default. Looking into the future, this default might makes sense for production kernels, assuming we implement a fast stack trace collection approach. Link: Signed-off-by: Andrey Konovalov <> Reviewed-by: Marco Elver <> Cc: Catalin Marinas <> Cc: Vincenzo Frascino <> Cc: Dmitry Vyukov <> Cc: Alexander Potapenko <> Cc: Will Deacon <> Cc: Andrey Ryabinin <> Cc: Peter Collingbourne <> Cc: Evgenii Stepanov <> Cc: Branislav Rankov <> Cc: Kevin Brodsky <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/kasan')
1 files changed, 2 insertions, 6 deletions
diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
index e529428e7a11..d558799b25b3 100644
--- a/mm/kasan/hw_tags.c
+++ b/mm/kasan/hw_tags.c
@@ -134,12 +134,8 @@ void __init kasan_init_hw_tags(void)
switch (kasan_arg_stacktrace) {
- /*
- * Default to enabling stack trace collection for
- * debug kernels.
- */
- static_branch_enable(&kasan_flag_stacktrace);
+ /* Default to enabling stack trace collection. */
+ static_branch_enable(&kasan_flag_stacktrace);
/* Do nothing, kasan_flag_stacktrace keeps its default value. */