linux/arch/s390
Vasily Gorbik 7ab41c2c08 s390/decompressor: specify __decompress() buf len to avoid overflow
Historically calls to __decompress() didn't specify "out_len" parameter
on many architectures including s390, expecting that no writes beyond
uncompressed kernel image are performed. This has changed since commit
2aa14b1ab2 ("zstd: import usptream v1.5.2") which includes zstd library
commit 6a7ede3dfccb ("Reduce size of dctx by reutilizing dst buffer
(#2751)"). Now zstd decompression code might store literal buffer in
the unwritten portion of the destination buffer. Since "out_len" is
not set, it is considered to be unlimited and hence free to use for
optimization needs. On s390 this might corrupt initrd or ipl report
which are often placed right after the decompressor buffer. Luckily the
size of uncompressed kernel image is already known to the decompressor,
so to avoid the problem simply specify it in the "out_len" parameter.

Link: https://github.com/facebook/zstd/commit/6a7ede3dfccb
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Link: https://lore.kernel.org/r/patch-1.thread-41c676.git-41c676c2d153.your-ad-here.call-01675030179-ext-9637@work.hours
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-01-31 18:54:21 +01:00
..
appldata s390/appldata: remove power management callbacks 2022-12-02 18:25:04 +01:00
boot s390/decompressor: specify __decompress() buf len to avoid overflow 2023-01-31 18:54:21 +01:00
configs s390: update defconfigs 2023-01-11 21:26:40 +01:00
crypto crypto: Kconfig - simplify cipher entries 2022-08-26 18:50:43 +08:00
hypfs s390/hypfs: remove unused info_blk_hdr__pcpus() function 2022-11-23 16:24:07 +01:00
include s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple() 2023-01-11 15:28:47 +01:00
kernel s390: workaround invalid gcc-11 out of bounds read warning 2023-01-17 19:00:59 +01:00
kvm KVM: s390: interrupt: use READ_ONCE() before cmpxchg() 2023-01-11 15:28:47 +01:00
lib s390/uaccess: add missing EX_TABLE entries to __clear_user() 2022-10-26 14:47:30 +02:00
mm ARM64: 2022-12-15 11:12:21 -08:00
net s390/bpf: Fix typo in comment 2022-05-23 11:25:53 -07:00
pci IOMMU Updates for Linux v6.2 2022-12-19 08:34:39 -06:00
purgatory s390/purgatory: remove duplicated build rule of kexec-purgatory.o 2022-06-30 14:18:16 +02:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig s390 updates for 6.2 merge window 2022-12-12 11:04:08 -08:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: always build relocatable kernel 2022-11-08 19:32:32 +01:00