aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2020-12-22 12:00:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-22 12:55:07 -0800
commitd73b49365ee65ac48074bdb5aa717bb4644dbbb7 (patch)
tree47a5fc5a06d6c5c33db6cedf9d8908329f373086 /arch
parentafe6ef80dcecf2cf7ccab0d94257b985e4c47d80 (diff)
downloadlinux-stericsson-d73b49365ee65ac48074bdb5aa717bb4644dbbb7.tar.gz
kasan, arm64: only use kasan_depth for software modes
This is a preparatory commit for the upcoming addition of a new hardware tag-based (MTE-based) KASAN mode. Hardware tag-based KASAN won't use kasan_depth. Only define and use it when one of the software KASAN modes are enabled. No functional changes for software modes. Link: https://lkml.kernel.org/r/e16f15aeda90bc7fb4dfc2e243a14b74cc5c8219.1606161801.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Alexander Potapenko <glider@google.com> Tested-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Branislav Rankov <Branislav.Rankov@arm.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Evgenii Stepanov <eugenis@google.com> Cc: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Marco Elver <elver@google.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/mm/kasan_init.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index ffeb80d5aa8d..5172799f831f 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -273,17 +273,22 @@ static void __init kasan_init_shadow(void)
cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
}
+static void __init kasan_init_depth(void)
+{
+ init_task.kasan_depth = 0;
+}
+
#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS) */
static inline void __init kasan_init_shadow(void) { }
+static inline void __init kasan_init_depth(void) { }
+
#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
void __init kasan_init(void)
{
kasan_init_shadow();
-
- /* At this point kasan is fully initialized. Enable error messages */
- init_task.kasan_depth = 0;
+ kasan_init_depth();
pr_info("KernelAddressSanitizer initialized\n");
}