linux/mm/kasan
Hailong Liu 29970dc24f arm/kasan: fix the array size of kasan_early_shadow_pte[]
The size of kasan_early_shadow_pte[] now is PTRS_PER_PTE which defined
to 512 for arm.  This means that it only covers the prev Linux pte
entries, but not the HWTABLE pte entries for arm.

The reason it currently works is that the symbol kasan_early_shadow_page
immediately following kasan_early_shadow_pte in memory is page aligned,
which makes kasan_early_shadow_pte look like a 4KB size array.  But we
can't ensure the order is always right with different compiler/linker,
or if more bss symbols are introduced.

We had a test with QEMU + vexpress:put a 512KB-size symbol with
attribute __section(".bss..page_aligned") after kasan_early_shadow_pte,
and poisoned it after kasan_early_init().  Then enabled CONFIG_KASAN, it
failed to boot up.

Link: https://lkml.kernel.org/r/20210109044622.8312-1-hailongliiu@yeah.net
Signed-off-by: Hailong Liu <liu.hailong6@zte.com.cn>
Signed-off-by: Ziliang Guo <guo.ziliang@zte.com.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-01-12 18:12:54 -08:00
..
common.c kasan, mm: allow cache merging with no metadata 2020-12-22 12:55:09 -08:00
generic.c kasan: fix null pointer dereference in kasan_record_aux_stack 2020-12-29 15:36:49 -08:00
hw_tags.c kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00
init.c arm/kasan: fix the array size of kasan_early_shadow_pte[] 2021-01-12 18:12:54 -08:00
kasan.h kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00
Makefile kasan, arm64: implement HW_TAGS runtime 2020-12-22 12:55:08 -08:00
quarantine.c kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00
report_generic.c kasan: separate metadata_fetch_row for each mode 2020-12-22 12:55:07 -08:00
report_hw_tags.c kasan: inline kasan_reset_tag for tag-based modes 2020-12-22 12:55:08 -08:00
report_sw_tags.c kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00
report.c kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00
shadow.c kasan: don't round_up too much 2020-12-22 12:55:09 -08:00
sw_tags.c kasan: sanitize objects when metadata doesn't fit 2020-12-22 12:55:09 -08:00