]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: fix KASAN_INLINE
authorMark Rutland <mark.rutland@arm.com>
Wed, 13 Jul 2022 14:09:49 +0000 (15:09 +0100)
committerWill Deacon <will@kernel.org>
Wed, 20 Jul 2022 15:08:10 +0000 (16:08 +0100)
commit21cf826fcae2be8f90d18069d21fafabbcf5f8d4
treec58b828600bf30c24250f68dcd7122c7ed5ecfab
parenta4c99e7c6b42380720ae8852a9a30b77c6dcfeac
arm64: fix KASAN_INLINE

Since commit:

  491efa47e31a5eb9 ("arm64: idreg-override: use early FDT mapping in ID map")

Kernels built with KASAN_INLINE=y die early in boot before producing any
console output. This is because the accesses made to the FDT (e.g. in
generic string processing functions) are instrumented with KASAN, and
with KASAN_INLINE=y any access to an address in TTBR0 results in a bogus
shadow VA, resulting in a data abort.

This patch fixes this by reverting commits:

  d3d2e2c882a16f9b ("arm64: setup: drop early FDT pointer helpers")
  bd0c3fa21878b6d0 ("arm64: idreg-override: use early FDT mapping in ID map")

... and using the TTBR1 fixmap mapping of the FDT.

Note that due to a later commit:

  e52b2e436cb1ba54 ("arm64: Save state of HCR_EL2.E2H before switch to EL1")

... which altered the prototype of init_feature_override() (and
invocation from head.S), commit bd0c3fa21878b6d0 does not revert
cleanly, and I've fixed that up manually.

Fixes: 491efa47e31a ("arm64: idreg-override: use early FDT mapping in ID map")
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Will Deacon <will@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20220713140949.45440-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/setup.h
arch/arm64/kernel/head.S
arch/arm64/kernel/idreg-override.c
arch/arm64/kernel/setup.c