Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: horms@verge.net.au
Cc: kexec@lists.infradead.org
Subject: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
Date: Thu, 8 Dec 2016 10:52:22 +0800	[thread overview]
Message-ID: <20161208025222.GA5427@dhcp-128-65.nay.redhat.com> (raw)

I got below error while tesing kexec -p:
"Can't find kernel text map area from kcore"

The case is the pt_load start addr was same as stext_sym. The checking
code should really be saddr <= stext_sym so that the right pt_load area
includes stext_sym can be matched.

This was not reported by people previously because it will fail over to
use hardcode X86_64__START_KERNEL_map to match the pt_load areas again
in later code and it sometimes succeeds because of kernel address
randomization.

With this change according to my test stext_sym checking can garantee
falling into right pt_load area if we get correct stext_sym.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 kexec/arch/i386/crashdump-x86.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- kexec-tools.orig/kexec/arch/i386/crashdump-x86.c
+++ kexec-tools/kexec/arch/i386/crashdump-x86.c
@@ -205,7 +205,7 @@ static int get_kernel_vaddr_and_size(str
 			unsigned long long size;
 
 			/* Look for kernel text mapping header. */
-			if (saddr < stext_sym && eaddr > stext_sym) {
+			if (saddr <= stext_sym && eaddr > stext_sym) {
 				saddr = _ALIGN_DOWN(saddr, X86_64_KERN_VADDR_ALIGN);
 				elf_info->kern_vaddr_start = saddr;
 				size = eaddr - saddr;

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2016-12-08  2:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08  2:52 Dave Young [this message]
2016-12-08 10:04 ` [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161208025222.GA5427@dhcp-128-65.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox