summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/va_layout.c
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2020-10-24 18:33:38 +0300
committerMarc Zyngier <maz@kernel.org>2020-11-27 14:32:43 +0300
commit68b824e428c5fb5c3dc5ef80b1543e767534b58e (patch)
tree93f0cc373bf871d0eddcdef77fc5ca0d8bb17c8c /arch/arm64/kvm/va_layout.c
parent7cd0aaafaadcaaf280887f8b478393a9fcfc69e3 (diff)
downloadlinux-68b824e428c5fb5c3dc5ef80b1543e767534b58e.tar.xz
KVM: arm64: Patch kimage_voffset instead of loading the EL1 value
Directly using the kimage_voffset variable is fine for now, but will become more problematic as we start distrusting EL1. Instead, patch the kimage_voffset into the HYP text, ensuring we don't have to load an untrusted value later on. Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/va_layout.c')
-rw-r--r--arch/arm64/kvm/va_layout.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index 1d00d2cb93fd..d61117805de0 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -251,3 +251,9 @@ void kvm_update_kimg_phys_offset(struct alt_instr *alt,
{
generate_mov_q(kimage_voffset + PHYS_OFFSET, origptr, updptr, nr_inst);
}
+
+void kvm_get_kimage_voffset(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst)
+{
+ generate_mov_q(kimage_voffset, origptr, updptr, nr_inst);
+}