+ x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers()
has been added to the -mm tree.  Its filename is
     x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx>
Subject: x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers()

The code guarded by CONFIG_X86_64 is necessary on some architectures which
have a dedicated kernel mapping outside of linear memory mapping.  (arm64
is among those.)

In this patch, an additional argument, kernel_map, is added to enable/
disable the code removing #ifdef.

Link: http://lkml.kernel.org/r/20180306102303.9063-5-takahiro.akashi@xxxxxxxxxx
Signed-off-by: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx>
Acked-by: Dave Young <dyoung@xxxxxxxxxx>
Tested-by: Dave Young <dyoung@xxxxxxxxxx>
Cc: Vivek Goyal <vgoyal@xxxxxxxxxx>
Cc: Baoquan He <bhe@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/x86/kernel/crash.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff -puN arch/x86/kernel/crash.c~x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers arch/x86/kernel/crash.c
--- a/arch/x86/kernel/crash.c~x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers
+++ a/arch/x86/kernel/crash.c
@@ -347,7 +347,7 @@ static int prepare_elf64_ram_headers_cal
 	return 0;
 }
 
-static int prepare_elf64_headers(struct crash_elf_data *ced,
+static int prepare_elf64_headers(struct crash_elf_data *ced, bool kernel_map,
 		void **addr, unsigned long *sz)
 {
 	Elf64_Ehdr *ehdr;
@@ -414,17 +414,17 @@ static int prepare_elf64_headers(struct
 	phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE;
 	(ehdr->e_phnum)++;
 
-#ifdef CONFIG_X86_64
 	/* Prepare PT_LOAD type program header for kernel text region */
-	phdr = (Elf64_Phdr *)bufp;
-	bufp += sizeof(Elf64_Phdr);
-	phdr->p_type = PT_LOAD;
-	phdr->p_flags = PF_R|PF_W|PF_X;
-	phdr->p_vaddr = (Elf64_Addr)_text;
-	phdr->p_filesz = phdr->p_memsz = _end - _text;
-	phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
-	(ehdr->e_phnum)++;
-#endif
+	if (kernel_map) {
+		phdr = (Elf64_Phdr *)bufp;
+		bufp += sizeof(Elf64_Phdr);
+		phdr->p_type = PT_LOAD;
+		phdr->p_flags = PF_R|PF_W|PF_X;
+		phdr->p_vaddr = (Elf64_Addr)_text;
+		phdr->p_filesz = phdr->p_memsz = _end - _text;
+		phdr->p_offset = phdr->p_paddr = __pa_symbol(_text);
+		(ehdr->e_phnum)++;
+	}
 
 	/* Go through all the ranges in cmem->ranges[] and prepare phdr */
 	for (i = 0; i < cmem->nr_ranges; i++) {
@@ -477,7 +477,7 @@ static int prepare_elf_headers(struct ki
 		goto out;
 
 	/* By default prepare 64bit headers */
-	ret =  prepare_elf64_headers(ced, addr, sz);
+	ret =  prepare_elf64_headers(ced, IS_ENABLED(CONFIG_X86_64), addr, sz);
 	if (ret)
 		goto out;
 
_

Patches currently in -mm which might be from takahiro.akashi@xxxxxxxxxx are

kexec_file-make-an-use-of-purgatory-optional.patch
kexec_file-make-an-use-of-purgatory-optional-fix.patch
kexec_filex86powerpc-factor-out-kexec_file_ops-functions.patch
x86-kexec_file-purge-system-ram-walking-from-prepare_elf64_headers.patch
x86-kexec_file-remove-x86_64-dependency-from-prepare_elf64_headers.patch
x86-kexec_file-lift-crash_max_ranges-limit-on-crash_mem-buffer.patch
x86-kexec_file-clean-up-prepare_elf64_headers.patch
kexec_file-x86-move-re-factored-code-to-generic-side.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux