Skip to content

Commit

Permalink
riscv: Fix config KASAN && DEBUG_VIRTUAL
Browse files Browse the repository at this point in the history
__virt_to_phys function is called very early in the boot process (ie
kasan_early_init) so it should not be instrumented by KASAN otherwise it
bugs.

Fix this by declaring phys_addr.c as non-kasan instrumentable.

Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Fixes: 8ad8b72 (riscv: Add KASAN support)
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
  • Loading branch information
AlexGhiti authored and palmer-dabbelt committed Mar 3, 2022
1 parent 5f763b3 commit c648c4b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/riscv/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ obj-$(CONFIG_KASAN) += kasan_init.o
ifdef CONFIG_KASAN
KASAN_SANITIZE_kasan_init.o := n
KASAN_SANITIZE_init.o := n
ifdef CONFIG_DEBUG_VIRTUAL
KASAN_SANITIZE_physaddr.o := n
endif
endif

obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o

0 comments on commit c648c4b

Please sign in to comment.