lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-993a110319a4a60aadbd02f6defdebe048f7773b@git.kernel.org>
Date:   Tue, 15 Jan 2019 03:18:55 -0800
From:   tip-bot for Dave Young <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     tglx@...utronix.de, x86@...nel.org, vgoyal@...hat.com,
        akpm@...ux-foundation.org, hpa@...or.com, wang.yi59@....com.cn,
        schwidefsky@...ibm.com, bhe@...hat.com, bp@...e.de,
        linux-kernel@...r.kernel.org, mingo@...hat.com,
        ebiederm@...ssion.com, mingo@...nel.org, yannik@...britzki.me,
        dyoung@...hat.com, prudo@...ux.vnet.ibm.com,
        takahiro.akashi@...aro.org
Subject: [tip:x86/urgent] x86/kexec: Fix a kexec_file_load() failure

Commit-ID:  993a110319a4a60aadbd02f6defdebe048f7773b
Gitweb:     https://git.kernel.org/tip/993a110319a4a60aadbd02f6defdebe048f7773b
Author:     Dave Young <dyoung@...hat.com>
AuthorDate: Fri, 28 Dec 2018 09:12:47 +0800
Committer:  Borislav Petkov <bp@...e.de>
CommitDate: Tue, 15 Jan 2019 12:12:50 +0100

x86/kexec: Fix a kexec_file_load() failure

Commit

  b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")

changed the behavior of kexec_locate_mem_hole(): it will try to allocate
free memory only when kbuf.mem is initialized to zero.

However, x86's kexec_file_load() implementation reuses a struct
kexec_buf allocated on the stack and its kbuf.mem member gets set by
each kexec_add_buffer() invocation.

The second kexec_add_buffer() will reuse the same kbuf but not
reinitialize kbuf.mem.

Therefore, explictily reset kbuf.mem each time in order for
kexec_locate_mem_hole() to locate a free memory region each time.

 [ bp: massage commit message. ]

Fixes: b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
Signed-off-by: Dave Young <dyoung@...hat.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Acked-by: Baoquan He <bhe@...hat.com>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: AKASHI Takahiro <takahiro.akashi@...aro.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Philipp Rudo <prudo@...ux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Vivek Goyal <vgoyal@...hat.com>
Cc: Yannik Sembritzki <yannik@...britzki.me>
Cc: Yi Wang <wang.yi59@....com.cn>
Cc: kexec@...ts.infradead.org
Cc: x86-ml <x86@...nel.org>
Link: https://lkml.kernel.org/r/20181228011247.GA9999@dhcp-128-65.nay.redhat.com
---
 arch/x86/kernel/crash.c           | 1 +
 arch/x86/kernel/kexec-bzimage64.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index c8b07d8ea5a2..17ffc869cab8 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -470,6 +470,7 @@ int crash_load_segments(struct kimage *image)
 
 	kbuf.memsz = kbuf.bufsz;
 	kbuf.buf_align = ELF_CORE_HEADER_ALIGN;
+	kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 	ret = kexec_add_buffer(&kbuf);
 	if (ret) {
 		vfree((void *)image->arch.elf_headers);
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index 278cd07228dd..0d5efa34f359 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -434,6 +434,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
 	kbuf.memsz = PAGE_ALIGN(header->init_size);
 	kbuf.buf_align = header->kernel_alignment;
 	kbuf.buf_min = MIN_KERNEL_LOAD_ADDR;
+	kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 	ret = kexec_add_buffer(&kbuf);
 	if (ret)
 		goto out_free_params;
@@ -448,6 +449,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
 		kbuf.bufsz = kbuf.memsz = initrd_len;
 		kbuf.buf_align = PAGE_SIZE;
 		kbuf.buf_min = MIN_INITRD_LOAD_ADDR;
+		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
 		ret = kexec_add_buffer(&kbuf);
 		if (ret)
 			goto out_free_params;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ