The patch titled Subject: kasan, arm64: don't instrument functions that enable kasan has been added to the -mm tree. Its filename is kasan-arm64-dont-instrument-functions-that-enable-kasan.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-arm64-dont-instrument-functions-that-enable-kasan.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-arm64-dont-instrument-functions-that-enable-kasan.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Subject: kasan, arm64: don't instrument functions that enable kasan This patch prepares Software Tag-Based KASAN for stack tagging support. With stack tagging enabled, KASAN tags stack variable in each function in its prologue. In start_kernel() stack variables get tagged before KASAN is enabled via setup_arch()->kasan_init(). As the result the tags for start_kernel()'s stack variables end up in the temporary shadow memory. Later when KASAN gets enabled, switched to normal shadow, and starts checking tags, this leads to false-positive reports, as proper tags are missing in normal shadow. Disable KASAN instrumentation for start_kernel(). Also disable it for arm64's setup_arch() as a precaution (it doesn't have any stack variables right now). Link: http://lkml.kernel.org/r/55d432671a92e931ab8234b03dc36b14d4c21bfb.1596199677.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Elena Petrova <lenaptr@xxxxxxxxxx> Cc: Marco Elver <elver@xxxxxxxxxx> Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx> Cc: Walter Wu <walter-zh.wu@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/arm64/kernel/setup.c | 2 +- init/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/setup.c~kasan-arm64-dont-instrument-functions-that-enable-kasan +++ a/arch/arm64/kernel/setup.c @@ -276,7 +276,7 @@ arch_initcall(reserve_memblock_reserved_ u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; -void __init setup_arch(char **cmdline_p) +void __init __no_sanitize_address setup_arch(char **cmdline_p) { init_mm.start_code = (unsigned long) _text; init_mm.end_code = (unsigned long) _etext; --- a/init/main.c~kasan-arm64-dont-instrument-functions-that-enable-kasan +++ a/init/main.c @@ -827,7 +827,7 @@ void __init __weak arch_call_rest_init(v rest_init(); } -asmlinkage __visible void __init start_kernel(void) +asmlinkage __visible __no_sanitize_address void __init start_kernel(void) { char *command_line; char *after_dashes; _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-dont-tag-stacks-allocated-with-pagealloc.patch kasan-arm64-dont-instrument-functions-that-enable-kasan.patch kasan-allow-enabling-stack-tagging-for-tag-based-mode.patch kasan-adjust-kasan_stack_oob-for-tag-based-mode.patch