linux-stable/arch/arm64
Ard Biesheuvel 47546a1912 arm64: mm: install KPTI nG mappings with MMU enabled
In cases where we unmap the kernel while running in user space, we rely
on ASIDs to distinguish the minimal trampoline from the full kernel
mapping, and this means we must use non-global attributes for those
mappings, to ensure they are scoped by ASID and will not hit in the TLB
inadvertently.

We only do this when needed, as this is generally more costly in terms
of TLB pressure, and so we boot without these non-global attributes, and
apply them to all existing kernel mappings once all CPUs are up and we
know whether or not the non-global attributes are needed. At this point,
we cannot simply unmap and remap the entire address space, so we have to
update all existing block and page descriptors in place.

Currently, we go through a lot of trouble to perform these updates with
the MMU and caches off, to avoid violating break before make (BBM) rules
imposed by the architecture. Since we make changes to page tables that
are not covered by the ID map, we gain access to those descriptors by
disabling translations altogether. This means that the stores to memory
are issued with device attributes, and require extra care in terms of
coherency, which is costly. We also rely on the ID map to access a
shared flag, which requires the ID map to be executable and writable at
the same time, which is another thing we'd prefer to avoid.

So let's switch to an approach where we replace the kernel mapping with
a minimal mapping of a few pages that can be used for a minimal, ad-hoc
fixmap that we can use to map each page table in turn as we traverse the
hierarchy.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20220609174320.4035379-3-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
2022-06-23 18:26:13 +01:00
..
boot USB / Thunderbolt changes for 5.19-rc1 2022-06-03 11:17:49 -07:00
configs - Enable essential PMIC and regulatro drivers for MT8195. 2022-05-13 14:02:30 +02:00
crypto crypto: arm64/sm4 - Fix wrong dependency of NEON/CE implementation 2022-04-15 16:34:30 +08:00
hyperv
include ARM64: 2022-06-14 07:57:18 -07:00
kernel arm64: mm: install KPTI nG mappings with MMU enabled 2022-06-23 18:26:13 +01:00
kvm KVM: arm64: Remove redundant hyp_assert_lock_held() assertions 2022-06-09 13:24:02 +01:00
lib S390: 2022-05-26 14:20:14 -07:00
mm arm64: mm: install KPTI nG mappings with MMU enabled 2022-06-23 18:26:13 +01:00
net bpf, arm64: Clear prog->jited_len along prog->jited 2022-06-07 10:40:53 -07:00
tools arm64/sysreg: Fix typo in Enum element regex 2022-06-10 16:23:48 +01:00
xen
Kbuild
Kconfig RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
Kconfig.debug
Kconfig.platforms arm64 updates for 5.19: 2022-05-23 21:06:11 -07:00
Makefile kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00