]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: mm: limit linear region to 51 bits for KVM in nVHE mode
authorArd Biesheuvel <ardb@kernel.org>
Thu, 26 Aug 2021 16:56:13 +0000 (18:56 +0200)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 9 Sep 2021 17:02:08 +0000 (18:02 +0100)
commit032469c2e71cc44a347e0b57a6c339e92a420d6b
treeac2541a5fbee0dd924be3ecb35ce6b3f09d89e52
parent59435561a3eae045e5f9c520e3473981edc7a5fe
arm64: mm: limit linear region to 51 bits for KVM in nVHE mode

KVM in nVHE mode divides up its VA space into two equal halves, and
picks the half that does not conflict with the HYP ID map to map its
linear region. This worked fine when the kernel's linear map itself was
guaranteed to cover precisely as many bits of VA space, but this was
changed by commit 87e430e03d4452c7 ("arm64: mm: extend linear region for
52-bit VA configurations").

The result is that, depending on the placement of the ID map, kernel-VA
to hyp-VA translations may produce addresses that either conflict with
other HYP mappings (including the ID map itself) or generate addresses
outside of the 52-bit addressable range, neither of which is likely to
lead to anything useful.

Given that 52-bit capable cores are guaranteed to implement VHE, this
only affects configurations such as pKVM where we opt into non-VHE mode
even if the hardware is VHE capable. So just for these configurations,
let's limit the kernel linear map to 51 bits and work around the
problem.

Fixes: 87e430e03d44 ("arm64: mm: extend linear region for 52-bit VA configurations")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210826165613.60774-1-ardb@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/init.c