linux/arch
Vasily Gorbik 9ed522143f s390/decompressor: specify __decompress() buf len to avoid overflow
[ Upstream commit 7ab41c2c08 ]

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: 6a7ede3dfc
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-02-22 12:57:02 +01:00
..
alpha exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
arc arc: iounmap() arg is volatile 2022-11-03 23:59:15 +09:00
arm kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
arm64 kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
csky kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:27:21 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:27:20 +01:00
ia64 ia64: make IA64_MCA_RECOVERY bool instead of tristate 2023-02-01 08:27:21 +01:00
m68k exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
mips kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
nios2 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
openrisc exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
parisc parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case 2023-02-09 11:26:44 +01:00
powerpc powerpc/64s/interrupt: Fix interrupt exit race with security mitigation switch 2023-02-14 19:18:03 +01:00
riscv riscv: kprobe: Fixup misaligned load text 2023-02-22 12:57:00 +01:00
s390 s390/decompressor: specify __decompress() buf len to avoid overflow 2023-02-22 12:57:02 +01:00
sh exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
sparc exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
um UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-10-26 12:34:23 +02:00
x86 KVM: x86: Mitigate the cross-thread return address predictions bug 2023-02-14 19:18:05 +01:00
xtensa exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00