summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2013-08-06 04:14:33 (GMT)
committerAlexander Graf <agraf@suse.de>2013-08-28 14:41:14 (GMT)
commit9d1ffdd8f34b1f89264effd10e75ea4d6272690e (patch)
tree6521516a39e8675d6ef9daa22c875c51ab753c7b /tools/lib
parent7bfa9ad55d691f2b836b576769b11eca2cf50816 (diff)
downloadlinux-fsl-qoriq-9d1ffdd8f34b1f89264effd10e75ea4d6272690e.tar.xz
KVM: PPC: Book3S PR: Don't corrupt guest state when kernel uses VMX
Currently the code assumes that once we load up guest FP/VSX or VMX state into the CPU, it stays valid in the CPU registers until we explicitly flush it to the thread_struct. However, on POWER7, copy_page() and memcpy() can use VMX. These functions do flush the VMX state to the thread_struct before using VMX instructions, but if this happens while we have guest state in the VMX registers, and we then re-enter the guest, we don't reload the VMX state from the thread_struct, leading to guest corruption. This has been observed to cause guest processes to segfault. To fix this, we check before re-entering the guest that all of the bits corresponding to facilities owned by the guest, as expressed in vcpu->arch.guest_owned_ext, are set in current->thread.regs->msr. Any bits that have been cleared correspond to facilities that have been used by kernel code and thus flushed to the thread_struct, so for them we reload the state from the thread_struct. We also need to check current->thread.regs->msr before calling giveup_fpu() or giveup_altivec(), since if the relevant bit is clear, the state has already been flushed to the thread_struct and to flush it again would corrupt it. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'tools/lib')
0 files changed, 0 insertions, 0 deletions