linux/arch/s390
Thomas Huth a13b03bbb4 KVM: s390: Test for bad access register and size at the start of S390_MEM_OP
If the KVM_S390_MEM_OP ioctl is called with an access register >= 16,
then there is certainly a bug in the calling userspace application.
We check for wrong access registers, but only if the vCPU was already
in the access register mode before (i.e. the SIE block has recorded
it). The check is also buried somewhere deep in the calling chain (in
the function ar_translation()), so this is somewhat hard to find.

It's better to always report an error to the userspace in case this
field is set wrong, and it's safer in the KVM code if we block wrong
values here early instead of relying on a check somewhere deep down
the calling chain, so let's add another check to kvm_s390_guest_mem_op()
directly.

We also should check that the "size" is non-zero here (thanks to Janosch
Frank for the hint!). If we do not check the size, we could call vmalloc()
with this 0 value, and this will cause a kernel warning.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Link: https://lkml.kernel.org/r/20190829122517.31042-1-thuth@redhat.com
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2019-08-29 16:08:38 +02:00
..
appldata proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
boot s390: enable detection of kernel version from bzImage 2019-07-23 10:43:50 +02:00
configs Kbuild updates for v5.3 2019-07-12 16:03:16 -07:00
crypto s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP 2019-06-15 12:24:48 +02:00
hypfs s390/hypfs: fix a typo in the name of a function 2019-07-23 10:45:32 +02:00
include SPDX fixes for 5.3-rc2 2019-07-28 10:00:06 -07:00
kernel s390: wire up clone3 system call 2019-07-23 10:45:53 +02:00
kvm KVM: s390: Test for bad access register and size at the start of S390_MEM_OP 2019-08-29 16:08:38 +02:00
lib s390: enforce CONFIG_SMP 2019-06-07 10:09:37 +02:00
mm s390/mm: use shared variables for sysctl range check 2019-07-26 13:36:22 +02:00
net s390: bpf: eliminate zero extension code-gen 2019-05-24 18:58:38 -07:00
numa treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
oprofile s390/unwind: introduce stack unwind API 2019-05-02 13:54:11 +02:00
pci s390 updates for the 5.3 merge window #2 2019-07-12 15:39:22 -07:00
purgatory s390/purgatory: update .gitignore 2019-06-04 15:03:42 +02:00
scripts s390: make chkbss work with clang 2019-04-11 13:36:52 +02:00
tools s390/disassembler: update opcode table 2019-06-04 15:03:58 +02:00
Kbuild s390/kexec_file: Add purgatory 2018-04-16 09:10:22 +02:00
Kconfig dma-direct: Force unencrypted DMA under SME for certain DMA masks 2019-07-16 22:15:46 +02:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile Kconfig updates for v5.3 2019-07-12 16:06:27 -07:00