RFC kvm: arm64: Fix up hyp relocations
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 9 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | kvm: arm64: Set up .hyp.rodata ELF sectionarch/ arch/ arch/ +1 more | +9 | 1 reply | |
| 2/6 | kvm: arm64: Fix up RELA relocations in hyp code/dataarch/ arch/ arch/ | +80 | 2 replies | |
| 3/6 | kvm: arm64: Fix up RELR relocation in hyp code/dataarch/ | +41 | 2 replies | |
| 4/6 | kvm: arm64: Remove patching of fn pointers in hyparch/ arch/ arch/ +1 more | +4 | 1 reply | |
| 5/6 | kvm: arm64: Fix constant-pool users in hyparch/ arch/ | +34 | 2 replies | |
| 6/6 | kvm: arm64: Remove hyp_symbol_addrarch/ arch/ arch/ +2 more | +7 | 1 reply |
Reviews trailers per patch
2 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Ard Biesheuvel |
|---|---|
| 1/6 | |
| 2/6 | |
| 3/6 | |
| 4/6 | A-b |
| 5/6 | |
| 6/6 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC PATCH 0/6] kvm: arm64: Fix up hyp relocations
Hi,
KVM nVHE hyp code runs under different VA mapping than the kernel, which meant that .hyp.text code had to use PC-relative addressing because relocations would produce a kernel VA. Programmers had to be extremely careful with C semantics to not break this fragile setup. See hyp_symbol_addr comments for details.
Now that we're moving to all nVHE hyp code/data being in separate ELF sections from the rest of the kernel, it is becoming possible to revisit relocations during early boot, filter those used by nVHE hyp and converting those (already relocated) kern VAs to hyp VAs.
Sending this as an RFC, mainly to get feedback but also because it's only lightly tested. It still feels hacky but much more robust than the existing approach. The one place where I see somebody breaking this is the list of ELF sections owned by ELF. That list is currently evolving but should stabilize over time.
The patches are based on kvmarm/queue (with Marc's "Host EL2 entry improvements") and my "Opt-in always-on nVHE hypervisor" v2 series.
-David
David Brazdil (6):
kvm: arm64: Set up .hyp.rodata ELF section
kvm: arm64: Fix up RELA relocations in hyp code/data
kvm: arm64: Fix up RELR relocation in hyp code/data
kvm: arm64: Remove patching of fn pointers in hyp
kvm: arm64: Fix constant-pool users in hyp
kvm: arm64: Remove hyp_symbol_addr
arch/arm64/include/asm/kvm_asm.h | 20 ---- arch/arm64/include/asm/kvm_mmu.h | 48 ++++----- arch/arm64/include/asm/sections.h | 2 +- arch/arm64/kernel/image-vars.h | 1 - arch/arm64/kernel/smp.c | 4 +- arch/arm64/kernel/vmlinux.lds.S | 7 +- arch/arm64/kvm/arm.c | 7 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 4 +- arch/arm64/kvm/hyp/nvhe/host.S | 29 +++--- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 11 +- arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 4 +- arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 + arch/arm64/kvm/hyp/nvhe/psci-relay.c | 4 +- arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 2 +- arch/arm64/kvm/va_layout.c | 123 +++++++++++++++++++++-- 15 files changed, 175 insertions(+), 92 deletions(-)
Signature · 1 line
2.29.2.299.gdc1121823c-goog