linux-stable/arch/arm64/kernel
Marc Zyngier f1b6cff7c9 arm64: VHE: Enable EL2 MMU from the idmap
Enabling the MMU requires the write to SCTLR_ELx (and the ISB
that follows) to live in some identity-mapped memory. Otherwise,
the translation will result in something totally unexpected
(either fetching the wrong instruction stream, or taking a
fault of some sort).

This is exactly what happens in mutate_to_vhe(), as this code
lives in the .hyp.text section, which isn't identity-mapped.
With the right configuration, this explodes badly.

Extract the MMU-enabling part of mutate_to_vhe(), and move
it to its own function that lives in the idmap. This ensures
nothing bad happens.

Fixes: f359182291 ("arm64: Provide an 'upgrade to VHE' stub hypercall")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Tested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210224093738.3629662-2-maz@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
2021-02-24 11:32:28 +00:00
..
probes arm64: uprobe: Return EOPNOTSUPP for AARCH32 instruction probing 2021-02-23 10:38:27 +00:00
vdso arm64: Support running gen_vdso_offsets.sh with BSD userland. 2021-01-20 12:23:27 +00:00
vdso32 arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
.gitignore
acpi.c arm64: permit ACPI core to map kernel memory used for table overrides 2020-09-30 22:27:51 +01:00
acpi_numa.c
acpi_parking_protocol.c
alternative.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
armv8_deprecated.c arm64: uaccess: rename privileged uaccess routines 2020-12-02 19:49:10 +00:00
asm-offsets.c arm64: Honor VHE being disabled from the command-line 2021-02-09 13:50:56 +00:00
cacheinfo.c
cpu-reset.h
cpu-reset.S arm64/relocate_kernel: remove redundant code 2020-09-11 19:06:25 +01:00
cpu_errata.c arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround 2021-02-08 17:39:02 +00:00
cpu_ops.c
cpufeature.c Merge branch 'for-next/errata' into for-next/core 2021-02-12 14:57:13 +00:00
cpuidle.c
cpuinfo.c arm64: avoid -Woverride-init warning 2020-10-28 13:38:36 +00:00
crash_core.c arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo 2020-07-02 17:56:49 +01:00
crash_dump.c
debug-monitors.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
efi-entry.S
efi-header.S arm64: head: tidy up the Image header definition 2020-11-17 16:14:20 +00:00
efi-rt-wrapper.S
efi.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
entry-common.c arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround 2021-02-08 17:39:02 +00:00
entry-fpsimd.S arm64/sve: Implement a helper to load SVE registers from FPSIMD state 2020-09-21 18:06:33 +01:00
entry-ftrace.S arm64: rename S_FRAME_SIZE to PT_REGS_SIZE 2021-01-13 15:09:06 +00:00
entry.S Merge branch 'for-next/stacktrace' into for-next/core 2021-02-12 15:14:22 +00:00
fpsimd.c arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
ftrace.c arm64: ftrace: Change CONFIG_FTRACE_WITH_REGS to CONFIG_DYNAMIC_FTRACE_WITH_REGS 2020-06-08 15:44:59 +01:00
head.S arm64: Defer enabling pointer authentication on boot core 2021-02-09 13:50:57 +00:00
hibernate-asm.S
hibernate.c arm64: hibernate: add __force attribute to gfp_t casting 2021-02-01 15:57:30 +00:00
hw_breakpoint.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hyp-stub.S arm64: VHE: Enable EL2 MMU from the idmap 2021-02-24 11:32:28 +00:00
idreg-override.c arm64: cpufeatures: Allow disabling of Pointer Auth from the command-line 2021-02-09 13:50:57 +00:00
image-vars.h kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
image.h arm64: get rid of TEXT_OFFSET 2020-09-07 15:00:52 +01:00
insn.c arm64: kprobe: disable probe of fault prone ptrauth instruction 2020-09-14 12:07:02 +01:00
io.c
irq.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
jump_label.c
kaslr.c arm64: Move "nokaslr" over to the early cpufeature infrastructure 2021-02-09 13:50:57 +00:00
kexec_image.c arm64: kexec_file: Fix sparse warning 2020-11-10 13:11:44 +00:00
kgdb.c arm64: kgdb: Fix single-step exception handling oops 2020-07-08 22:18:54 +01:00
kuser32.S
machine_kexec.c arm64: kexec: call kexec_image_info only once 2021-01-27 15:41:12 +00:00
machine_kexec_file.c arm64: kexec_file: fix memory leakage in create_dtb() when fdt_open_into() fails 2021-02-19 17:57:40 +00:00
Makefile Merge branch 'for-next/vdso' into for-next/core 2021-02-12 15:17:42 +00:00
module-plts.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
module.c kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
mte.c arm64: mte: switch GCR_EL1 in kernel entry and exit 2020-12-22 12:55:07 -08:00
paravirt.c arm64: paravirt: Initialize steal time when cpu is online 2020-09-17 18:12:18 +01:00
pci.c
perf_callchain.c arm64: stacktrace: Make stack walk callback consistent with generic code 2020-09-18 14:24:16 +01:00
perf_event.c Merge branch 'for-next/perf' into for-next/core 2021-02-12 15:09:34 +00:00
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
pointer_auth.c arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
process.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
proton-pack.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
psci.c arm64: psci: Avoid printing in cpu_psci_cpu_die() 2020-11-10 13:11:44 +00:00
ptrace.c arm64: ptrace: Fix missing return in hw breakpoint code 2021-02-02 21:07:56 +00:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp 2021-01-27 15:41:12 +00:00
return_address.c arm64: stacktrace: Make stack walk callback consistent with generic code 2020-09-18 14:24:16 +01:00
sdei.c Merge branch 'kvm-master' into kvm-next 2021-01-07 18:06:52 -05:00
setup.c arm64: Extract early FDT mapping from kaslr_early_init() 2021-02-09 13:47:50 +00:00
signal.c arm64: entry: remove redundant IRQ flag tracing 2021-01-13 12:51:30 +00:00
signal32.c arm64: compat: Always use sigpage for sigreturn trampoline 2020-06-23 14:56:24 +01:00
sigreturn32.S
sleep.S arm64: Initialise as nVHE before switching to VHE 2021-02-09 13:47:07 +00:00
smccc-call.S arm64/kernel: Remove needless Call Frame Information annotations 2020-09-01 09:50:36 +02:00
smp.c x86: 2021-01-08 15:06:02 -08:00
smp_spin_table.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
stacktrace.c arm64: remove EL0 exception frame record 2021-01-20 12:47:54 +00:00
suspend.c arm64: spectre: Prevent lockdep splat on v4 mitigation enable path 2021-02-19 17:49:24 +00:00
sys.c
sys32.c
sys_compat.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
syscall.c arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround 2021-02-08 17:39:02 +00:00
time.c
topology.c arm64: topology: Make AMUs work with modular cpufreq drivers 2021-01-20 12:49:40 +00:00
trace-events-emulation.h
traps.c arm64: improve whitespace 2021-02-04 13:59:49 +00:00
vdso-wrap.S arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
vdso.c mm: forbid splitting special mappings 2020-12-15 12:13:41 -08:00
vdso32-wrap.S arm64: do not descend to vdso directories twice 2021-01-20 12:18:46 +00:00
vmlinux.lds.S arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset 2021-02-03 20:43:45 +00:00