+ kexec_file-remove-checks-in-kexec_purgatory_load.patch added to -mm tree

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

 



The patch titled
     Subject: kernel/kexec_file.c: remove checks in kexec_purgatory_load
has been added to the -mm tree.  Its filename is
     kexec_file-remove-checks-in-kexec_purgatory_load.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-remove-checks-in-kexec_purgatory_load.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-remove-checks-in-kexec_purgatory_load.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: Philipp Rudo <prudo@xxxxxxxxxxxxxxxxxx>
Subject: kernel/kexec_file.c: remove checks in kexec_purgatory_load

Before the purgatory is loaded several checks are done whether the ELF
file in kexec_purgatory is valid or not.  These checks are incomplete. 
For example they don't check for the total size of the sections defined in
the section header table or if the entry point actually points into the
purgatory.

On the other hand the purgatory, although an ELF file on its own, is part
of the kernel.  Thus not trusting the purgatory means not trusting the
kernel build itself.

So remove all validity checks on the purgatory and just trust the kernel
build.

Link: http://lkml.kernel.org/r/20180321112751.22196-3-prudo@xxxxxxxxxxxxxxxxxx
Signed-off-by: Philipp Rudo <prudo@xxxxxxxxxxxxxxxxxx>
Cc: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx>
Cc: Dave Young <dyoung@xxxxxxxxxx>
Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx>
Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxxxxxxx>
Cc: Vivek Goyal <vgoyal@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/kexec_file.c |   14 --------------
 1 file changed, 14 deletions(-)

diff -puN kernel/kexec_file.c~kexec_file-remove-checks-in-kexec_purgatory_load kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-remove-checks-in-kexec_purgatory_load
+++ a/kernel/kexec_file.c
@@ -983,22 +983,8 @@ int kexec_load_purgatory(struct kimage *
 	if (kexec_purgatory_size <= 0)
 		return -EINVAL;
 
-	if (kexec_purgatory_size < sizeof(Elf_Ehdr))
-		return -ENOEXEC;
-
 	pi->ehdr = (Elf_Ehdr *)kexec_purgatory;
 
-	if (memcmp(pi->ehdr->e_ident, ELFMAG, SELFMAG) != 0
-	    || pi->ehdr->e_type != ET_REL
-	    || !elf_check_arch(pi->ehdr)
-	    || pi->ehdr->e_shentsize != sizeof(Elf_Shdr))
-		return -ENOEXEC;
-
-	if (pi->ehdr->e_shoff >= kexec_purgatory_size
-	    || (pi->ehdr->e_shnum * sizeof(Elf_Shdr) >
-	    kexec_purgatory_size - pi->ehdr->e_shoff))
-		return -ENOEXEC;
-
 	ret = __kexec_load_purgatory(image, min, max, top_down);
 	if (ret)
 		return ret;
_

Patches currently in -mm which might be from prudo@xxxxxxxxxxxxxxxxxx are

kexec_file-silence-compile-warnings.patch
kexec_file-remove-checks-in-kexec_purgatory_load.patch
kexec_file-make-purgatory_info-ehdr-const.patch
kexec_file-search-symbols-in-read-only-kexec_purgatory.patch
kexec_file-use-read-only-sections-in-arch_kexec_apply_relocations.patch
kexec_file-split-up-__kexec_load_puragory.patch
kexec_file-remove-unneeded-for-loop-in-kexec_purgatory_setup_sechdrs.patch
kexec_file-remove-unneeded-variables-in-kexec_purgatory_setup_sechdrs.patch
kexec_file-remove-mis-use-of-sh_offset-field-during-purgatory-load.patch
kexec_file-allow-archs-to-set-purgatory-load-address.patch
kexec_file-move-purgatories-sha256-to-common-code.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