linux-stable/arch/s390
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
..
appldata s390: appldata: drop owner assignment from platform_drivers 2014-10-20 16:20:13 +02:00
boot s390/boot/decompression: disable floating point in decompressor 2015-09-29 14:45:10 +02:00
configs s390/configs: update default configurations 2016-01-11 13:01:28 +01:00
crypto crypto: s390/sha - replace raw value by their coresponding define 2015-10-15 21:05:11 +08:00
hypfs s390/diag: add a statistic for diagnose calls 2015-10-14 14:32:06 +02:00
include KVM: s390: fix memory overwrites when vx is disabled 2016-01-26 15:40:21 +01:00
kernel Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching 2016-01-14 16:38:02 -08:00
kvm KVM: s390: fix memory overwrites when vx is disabled 2016-01-26 15:40:21 +01:00
lib s390/spinlock: do not yield to a CPU in udelay/mdelay 2015-11-27 09:24:18 +01:00
mm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-01-13 13:16:16 -08:00
net bpf: move clearing of A/X into classic to eBPF migration prologue 2015-12-18 16:04:51 -05:00
numa s390/numa: write kernel message when emu_size has been increased 2015-10-14 14:31:59 +02:00
oprofile s390/oprofile: fix compile error 2015-07-01 09:34:39 +02:00
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-01-13 13:16:16 -08:00
tools s390/facilities: add helper tool to generate facility lists 2015-12-18 14:59:20 +01:00
defconfig s390/configs: update default configurations 2016-01-11 13:01:28 +01:00
Kbuild s390/numa: add core infrastructure 2015-08-03 18:40:25 +02:00
Kconfig libnvdimm for 4.5 2016-01-13 19:15:14 -08:00
Kconfig.debug arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug 2016-01-09 06:30:49 -08:00
Makefile s390/facilities: add helper tool to generate facility lists 2015-12-18 14:59:20 +01:00