linux-stable/arch/s390
Heiko Carstens 4f18d869ff s390: fix stfle zero padding
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>
2019-06-19 17:54:27 +02:00
..
appldata sched: loadavg: consolidate LOAD_INT, LOAD_FRAC, CALC_LOAD 2018-10-26 16:26:32 -07:00
boot s390/boot: fix compiler error due to missing awk strtonum 2019-05-07 14:37:14 +02:00
configs s390: replace defconfig with performance_defconfig 2019-06-19 17:54:27 +02:00
crypto s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP 2019-06-15 12:24:48 +02:00
hypfs s390/kernel: introduce .dma sections 2019-04-29 10:47:10 +02:00
include s390: fix stfle zero padding 2019-06-19 17:54:27 +02:00
kernel processor: get rid of cpu_relax_yield 2019-06-15 12:25:55 +02:00
kvm KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID 2019-05-28 15:52:19 +02:00
lib s390: enforce CONFIG_SMP 2019-06-07 10:09:37 +02:00
mm s390/mm: force swiotlb for protected virtualization 2019-06-15 12:24:51 +02:00
net s390: Convert IS_ENABLED uses to __is_defined 2019-04-11 13:36:53 +02: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/pci: fix assignment of bus resources 2019-05-28 14:49:32 +02: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 s390/cio: introduce DMA pools to cio 2019-06-15 12:24:56 +02:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile s390/boot: disable address-of-packed-member warning 2019-06-07 10:10:04 +02:00