kasan: Add __HAVE_ARCH_SHADOW_MAP to support arch specific mapping
authorQing Zhang <zhangqing@loongson.cn>
Wed, 6 Sep 2023 14:54:16 +0000 (22:54 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 6 Sep 2023 14:54:16 +0000 (22:54 +0800)
commit9b04c764af18a1dab6d48ca0671f70cdcccf90a2
treeb115d52dee1d22bc3dc54a8de8686da97557509c
parent6ad3df56bb199134800933df2afcd7df3b03ef33
kasan: Add __HAVE_ARCH_SHADOW_MAP to support arch specific mapping

MIPS, LoongArch and some other architectures have many holes between
different segments and the valid address space (256T available) is
insufficient to map all these segments to kasan shadow memory with the
common formula provided by kasan core. So we need architecture specific
mapping formulas to ensure different segments are mapped individually,
and only limited space lengths of those specific segments are mapped to
shadow.

Therefore, when the incoming address is converted to a shadow, we need
to add a condition to determine whether it is valid.

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
include/linux/kasan.h
mm/kasan/kasan.h