android_kernel_oneplus_msm8998/arch/s390
Heiko Carstens a4db512760 s390: fix stfle zero padding
commit 4f18d869ffd056c7858f3d617c71345cf19be008 upstream.

The stfle inline assembly returns the number of double words written
(condition code 0) or the double words it would have written
(condition code 3), if the memory array it got as parameter would have
been large enough.

The current stfle implementation assumes that the array is always
large enough and clears those parts of the array that have not been
written to with a subsequent memset call.

If however the array is not large enough memset will get a negative
length parameter, which means that memset clears memory until it gets
an exception and the kernel crashes.

To fix this simply limit the maximum length. Move also the inline
assembly to an extra function to avoid clobbering of register 0, which
might happen because of the added min_t invocation together with code
instrumentation.

The bug was introduced with commit 14375bc4eb ("[S390] cleanup
facility list handling") but was rather harmless, since it would only
write to a rather large array. It became a potential problem with
commit 3ab121ab18 ("[S390] kernel: Add z/VM LGR detection"). Since
then it writes to an array with only four double words, while some
machines already deliver three double words. As soon as machines have
a facility bit within the fifth double a crash on IPL would happen.

Fixes: 14375bc4eb ("[S390] cleanup facility list handling")
Cc: <stable@vger.kernel.org> # v2.6.37+
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-21 09:07:15 +02:00
..
appldata
boot s390/decompressor: fix initrd corruption caused by bss clear 2017-04-12 12:38:34 +02:00
configs s390/defconfig: set SCSI_DH=y 2015-10-01 10:48:36 +02:00
crypto s390/crypto: unlock on error in prng_tdes_read() 2017-01-12 11:22:49 +01:00
hypfs hypfs_kill_super(): deal with failed allocations 2018-04-24 09:32:11 +02:00
include s390: fix stfle zero padding 2019-07-21 09:07:15 +02:00
kernel s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU 2019-02-06 19:43:05 +01:00
kvm KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION 2019-06-22 08:18:23 +02:00
lib s390/lib: use expoline for all bcr instructions 2018-09-15 09:40:42 +02:00
mm mm: replace get_user_pages_unlocked() write/force parameters with gup_flags 2018-12-17 21:55:16 +01:00
net s390: fix br_r1_trampoline for machines without exrl 2018-09-05 09:18:40 +02:00
numa s390/mm: Fix ERROR: "__node_distance" undefined! 2018-11-27 16:08:01 +01:00
oprofile s390/oprofile: fix compile error 2015-07-01 09:34:39 +02:00
pci s390/pci: fix out of bounds access during irq setup 2018-09-05 09:18:40 +02:00
defconfig s390: new default configuration 2015-06-25 09:39:25 +02:00
Kbuild s390/numa: add core infrastructure 2015-08-03 18:40:25 +02:00
Kconfig s390: add sysfs attributes for spectre 2018-04-29 07:50:04 +02:00
Kconfig.debug
Makefile s390: add automatic detection of the spectre defense 2018-04-29 07:50:04 +02:00