summaryrefslogtreecommitdiff
path: root/arch/riscv/mm/kasan_init.c
diff options
context:
space:
mode:
authorAlexandre Ghiti <alexandre.ghiti@canonical.com>2021-10-29 07:59:27 +0300
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-10-29 18:54:50 +0300
commit54c5639d8f507ebefa814f574cb6f763033a72a5 (patch)
treeac9ba5ba08a776edb2f16e7482d6fb35d1fe4e06 /arch/riscv/mm/kasan_init.c
parentcf11d01135ea1ff7fddb612033e3cb5cde279ff2 (diff)
downloadlinux-54c5639d8f507ebefa814f574cb6f763033a72a5.tar.xz
riscv: Fix asan-stack clang build
Nathan reported that because KASAN_SHADOW_OFFSET was not defined in Kconfig, it prevents asan-stack from getting disabled with clang even when CONFIG_KASAN_STACK is disabled: fix this by defining the corresponding config. Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Fixes: 8ad8b72721d0 ("riscv: Add KASAN support") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/mm/kasan_init.c')
-rw-r--r--arch/riscv/mm/kasan_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
index 89a8376ce44e..54294f83513d 100644
--- a/arch/riscv/mm/kasan_init.c
+++ b/arch/riscv/mm/kasan_init.c
@@ -17,6 +17,9 @@ asmlinkage void __init kasan_early_init(void)
uintptr_t i;
pgd_t *pgd = early_pg_dir + pgd_index(KASAN_SHADOW_START);
+ BUILD_BUG_ON(KASAN_SHADOW_OFFSET !=
+ KASAN_SHADOW_END - (1UL << (64 - KASAN_SHADOW_SCALE_SHIFT)));
+
for (i = 0; i < PTRS_PER_PTE; ++i)
set_pte(kasan_early_shadow_pte + i,
mk_pte(virt_to_page(kasan_early_shadow_page),