aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2018-04-20 17:56:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-20 20:18:36 -0400
commita841aa83dff0af75c88aa846ba610a8af4c5ee21 (patch)
tree1d7fadae7e93901f66eec590e485a84a9199d19c
parent9a1015b32faa7cebfe19663c886b0cfe90be1d49 (diff)
kexec_file: do not add extra alignment to efi memmap
Chun-Yi reported a kernel warning message below: WARNING: CPU: 0 PID: 0 at ../mm/early_ioremap.c:182 early_iounmap+0x4f/0x12c() early_iounmap(ffffffffff200180, 00000118) [0] size not consistent 00000120 The problem is x86 kexec_file_load adds extra alignment to the efi memmap: in bzImage64_load(): efi_map_sz = efi_get_runtime_map_size(); efi_map_sz = ALIGN(efi_map_sz, 16); And __efi_memmap_init maps with the size including the alignment bytes but efi_memmap_unmap use nr_maps * desc_size which does not include the extra bytes. The alignment in kexec code is only needed for the kexec buffer internal use Actually kexec should pass exact size of the efi memmap to 2nd kernel. Link: http://lkml.kernel.org/r/20180417083600.GA1972@dhcp-128-65.nay.redhat.com Signed-off-by: Dave Young <dyoung@redhat.com> Reported-by: joeyli <jlee@suse.com> Tested-by: Randy Wright <rwright@hpe.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/x86/kernel/kexec-bzimage64.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index 3182908b7e6c..7326078eaa7a 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -398,11 +398,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
398 * little bit simple 398 * little bit simple
399 */ 399 */
400 efi_map_sz = efi_get_runtime_map_size(); 400 efi_map_sz = efi_get_runtime_map_size();
401 efi_map_sz = ALIGN(efi_map_sz, 16);
402 params_cmdline_sz = sizeof(struct boot_params) + cmdline_len + 401 params_cmdline_sz = sizeof(struct boot_params) + cmdline_len +
403 MAX_ELFCOREHDR_STR_LEN; 402 MAX_ELFCOREHDR_STR_LEN;
404 params_cmdline_sz = ALIGN(params_cmdline_sz, 16); 403 params_cmdline_sz = ALIGN(params_cmdline_sz, 16);
405 kbuf.bufsz = params_cmdline_sz + efi_map_sz + 404 kbuf.bufsz = params_cmdline_sz + ALIGN(efi_map_sz, 16) +
406 sizeof(struct setup_data) + 405 sizeof(struct setup_data) +
407 sizeof(struct efi_setup_data); 406 sizeof(struct efi_setup_data);
408 407
@@ -410,7 +409,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
410 if (!params) 409 if (!params)
411 return ERR_PTR(-ENOMEM); 410 return ERR_PTR(-ENOMEM);
412 efi_map_offset = params_cmdline_sz; 411 efi_map_offset = params_cmdline_sz;
413 efi_setup_data_offset = efi_map_offset + efi_map_sz; 412 efi_setup_data_offset = efi_map_offset + ALIGN(efi_map_sz, 16);
414 413
415 /* Copy setup header onto bootparams. Documentation/x86/boot.txt */ 414 /* Copy setup header onto bootparams. Documentation/x86/boot.txt */
416 setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset; 415 setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset;