Skip to content

Commit f6da927

Browse files
eaibmzgregkh
authored andcommitted
s390/kexec: fix ipl report address for kdump
commit c2337a4 upstream. This commit addresses the following erroneous situation with file-based kdump executed on a system with a valid IPL report. On s390, a kdump kernel, its initrd and IPL report if present are loaded into a special and reserved on boot memory region - crashkernel. When a system crashes and kdump was activated before, the purgatory code is entered first which swaps the crashkernel and [0 - crashkernel size] memory regions. Only after that the kdump kernel is entered. For this reason, the pointer to an IPL report in lowcore must point to the IPL report after the swap and not to the address of the IPL report that was located in crashkernel memory region before the swap. Failing to do so, makes the kdump's decompressor try to read memory from the crashkernel memory region which already contains the production's kernel memory. The situation described above caused spontaneous kdump failures/hangs on systems where the Secure IPL is activated because on such systems an IPL report is always present. In that case kdump's decompressor tried to parse an IPL report which frequently lead to illegal memory accesses because an IPL report contains addresses to various data. Cc: <[email protected]> Fixes: 99feaa7 ("s390/kexec_file: Create ipl report and pass to next kernel") Reviewed-by: Vasily Gorbik <[email protected]> Signed-off-by: Alexander Egorenkov <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4bf6e11 commit f6da927

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/s390/kernel/machine_kexec_file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ static int kexec_file_add_ipl_report(struct kimage *image,
185185

186186
data->memsz = ALIGN(data->memsz, PAGE_SIZE);
187187
buf.mem = data->memsz;
188-
if (image->type == KEXEC_TYPE_CRASH)
189-
buf.mem += crashk_res.start;
190188

191189
ptr = (void *)ipl_cert_list_addr;
192190
end = ptr + ipl_cert_list_size;
@@ -223,6 +221,9 @@ static int kexec_file_add_ipl_report(struct kimage *image,
223221
data->kernel_buf + offsetof(struct lowcore, ipl_parmblock_ptr);
224222
*lc_ipl_parmblock_ptr = (__u32)buf.mem;
225223

224+
if (image->type == KEXEC_TYPE_CRASH)
225+
buf.mem += crashk_res.start;
226+
226227
ret = kexec_add_buffer(&buf);
227228
out:
228229
return ret;

0 commit comments

Comments
 (0)