linux-stable/arch/s390
Philipp Rudo 41967a37b8 s390/kexec_file: fix error handling when applying relocations
arch_kexec_apply_relocations_add currently ignores all errors returned
by arch_kexec_do_relocs. This means that every unknown relocation is
silently skipped causing unpredictable behavior while the relocated code
runs. Fix this by checking for errors and fail kexec_file_load if an
unknown relocation type is encountered.

The problem was found after gcc changed its behavior and used
R_390_PLT32DBL relocations for brasl instruction and relied on ld to
resolve the relocations in the final link in case direct calls are
possible. As the purgatory code is only linked partially (option -r)
ld didn't resolve the relocations leaving them for arch_kexec_do_relocs.
But arch_kexec_do_relocs doesn't know how to handle R_390_PLT32DBL
relocations so they were silently skipped. This ultimately caused an
endless loop in the purgatory as the brasl instructions kept branching
to itself.

Fixes: 71406883fd ("s390/kexec_file: Add kexec_file_load system call")
Reported-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Philipp Rudo <prudo@redhat.com>
Link: https://lore.kernel.org/r/20211208130741.5821-3-prudo@redhat.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2021-12-10 16:12:33 +01:00
..
appldata s390/appldata: use struct_size() helper 2020-06-29 16:32:34 +02:00
boot s390/boot: simplify and fix kernel memory layout setup 2021-11-16 12:29:19 +01:00
configs s390: update defconfigs 2021-12-02 19:29:44 +01:00
crypto s390/archrandom: add parameter check for s390_arch_random_generate 2021-04-21 12:32:12 +02:00
hypfs s390: rename dma section to amode31 2021-08-05 14:10:53 +02:00
include s390/pci: move pseudo-MMIO to prevent MIO overlap 2021-11-29 09:48:34 +01:00
kernel s390/kexec_file: fix error handling when applying relocations 2021-12-10 16:12:33 +01:00
kvm KVM: s390: Cap KVM_CAP_NR_VCPUS by num_online_cpus() 2021-11-18 02:12:15 -05:00
lib s390/test_unwind: use raw opcode instead of invalid instruction 2021-11-25 13:38:31 +01:00
mm Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
net s390: introduce nospec_uses_trampoline() 2021-10-26 15:21:29 +02:00
pci s390/pci: implement minimal PCI error recovery 2021-11-08 14:17:49 +01:00
purgatory s390: enable KCSAN 2021-07-30 17:09:23 +02:00
tools s390/disassembler: add instructions 2021-07-27 09:39:19 +02:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig ftrace/samples: add s390 support for ftrace direct multi sample 2021-11-18 17:50:54 +01:00
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile s390/vdso: filter out -mstack-guard and -mstack-size 2021-11-16 12:29:19 +01:00