linux/arch/s390/kvm
David Hildenbrand 9abc2a08a7 KVM: s390: fix memory overwrites when vx is disabled
The kernel now always uses vector registers when available, however KVM
has special logic if support is really enabled for a guest. If support
is disabled, guest_fpregs.fregs will only contain memory for the fpu.
The kernel, however, will store vector registers into that area,
resulting in crazy memory overwrites.

Simply extending that area is not enough, because the format of the
registers also changes. We would have to do additional conversions, making
the code even more complex. Therefore let's directly use one place for
the vector/fpu registers + fpc (in kvm_run). We just have to convert the
data properly when accessing it. This makes current code much easier.

Please note that vector/fpu registers are now always stored to
vcpu->run->s.regs.vrs. Although this data is visible to QEMU and
used for migration, we only guarantee valid values to user space  when
KVM_SYNC_VRS is set. As that is only the case when we have vector
register support, we are on the safe side.

Fixes: b5510d9b68 ("s390/fpu: always enable the vector facility if it is available")
Cc: stable@vger.kernel.org # v4.4 d9a3a09af5 s390/kvm: remove dependency on struct save_area definition
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[adopt to d9a3a09af5]
2016-01-26 15:40:21 +01:00
..
diag.c KVM: Use common function for VCPU lookup by id 2015-11-30 12:47:04 +01:00
gaccess.c KVM: s390: Introduce switching code 2015-11-30 12:47:08 +01:00
gaccess.h KVM: s390: Add MEMOP ioctls for reading/writing guest memory 2015-03-17 16:26:24 +01:00
guestdbg.c KVM: s390: filter space-switch events when PER is enforced 2015-07-29 10:36:22 +02:00
intercept.c KVM: s390: rewrite vcpu_post_run and drop out early 2015-11-30 12:47:05 +01:00
interrupt.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-01-13 13:16:16 -08:00
irq.h KVM: s390: irq routing for adapter interrupts. 2014-03-21 13:43:00 +01:00
Kconfig KVM: s390: Enable the KVM-VFIO device 2016-01-26 15:40:17 +01:00
kvm-s390.c KVM: s390: fix memory overwrites when vx is disabled 2016-01-26 15:40:21 +01:00
kvm-s390.h KVM: s390: Introduce new structures 2015-11-30 12:47:07 +01:00
Makefile KVM: s390: Enable the KVM-VFIO device 2016-01-26 15:40:17 +01:00
priv.c s390: rename struct _lowcore to struct lowcore 2016-01-11 12:27:15 +01:00
sigp.c KVM: s390: fix wrong lookup of VCPUs by array index 2015-11-19 14:47:43 +01:00
trace-s390.h KVM: s390: obey kptr_restrict in traces 2015-12-15 17:06:32 +01:00
trace.h KVM: s390: interpretive execution of SIGP EXTERNAL CALL 2014-05-16 14:57:28 +02:00