aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2014-03-13 05:02:48 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-03-13 05:47:01 -0400
commite724f080f5dd03881bc6d378750c37f7374cae7e (patch)
treee69c26e533240778a73df4265484f24ffdba1536 /arch/powerpc
parenta5b0ccb0b5d080c0decb4c9208d9bb6072defa50 (diff)
KVM: PPC: Book3S HV: Fix register usage when loading/saving VRSAVE
Commit 595e4f7e697e ("KVM: PPC: Book3S HV: Use load/store_fp_state functions in HV guest entry/exit") changed the register usage in kvmppc_save_fp() and kvmppc_load_fp() but omitted changing the instructions that load and save VRSAVE. The result is that the VRSAVE value was loaded from a constant address, and saved to a location past the end of the vcpu struct, causing host kernel memory corruption and various kinds of host kernel crashes. This fixes the problem by using register r31, which contains the vcpu pointer, instead of r3 and r4. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 781e6bf69afb..818dce344e82 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -2136,7 +2136,7 @@ BEGIN_FTR_SECTION
2136END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2136END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2137#endif 2137#endif
2138 mfspr r6,SPRN_VRSAVE 2138 mfspr r6,SPRN_VRSAVE
2139 stw r6,VCPU_VRSAVE(r3) 2139 stw r6,VCPU_VRSAVE(r31)
2140 mtlr r30 2140 mtlr r30
2141 mtmsrd r5 2141 mtmsrd r5
2142 isync 2142 isync
@@ -2173,7 +2173,7 @@ BEGIN_FTR_SECTION
2173 bl .load_vr_state 2173 bl .load_vr_state
2174END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2174END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2175#endif 2175#endif
2176 lwz r7,VCPU_VRSAVE(r4) 2176 lwz r7,VCPU_VRSAVE(r31)
2177 mtspr SPRN_VRSAVE,r7 2177 mtspr SPRN_VRSAVE,r7
2178 mtlr r30 2178 mtlr r30
2179 mr r4,r31 2179 mr r4,r31