From: Baoquan He <bhe@redhat.com>
To: horms@verge.net.au
Cc: kexec@lists.infradead.org, Baoquan He <bhe@redhat.com>, piliu@redhat.com
Subject: [PATCH] Only search page_offset_base when KASLR mm code is compiled in
Date: Fri, 24 Feb 2017 18:38:52 +0800 [thread overview]
Message-ID: <1487932732-24539-1-git-send-email-bhe@redhat.com> (raw)
Otherwise it will print false positve message as below. So add
a check when do the search.
"Cannot get kernel page_offset_base symbol address"
Signed-off-by: Baoquan He <bhe@redhat.com>
---
kexec/arch/i386/crashdump-x86.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 88aeee3..b2c1be5 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -150,8 +150,6 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
off_t size;
uint32_t elf_flags = 0;
uint64_t stext_sym;
- const unsigned long long pud_mask = ~((1 << 30) - 1);
- unsigned long long vaddr, lowest_vaddr = 0;
if (elf_info->machine != EM_X86_64)
return 0;
@@ -181,8 +179,11 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
end_phdr = &ehdr.e_phdr[ehdr.e_phnum];
+#ifdef CONFIG_RANDOMIZE_MEMORY
/* Search for the real PAGE_OFFSET when KASLR memory randomization
* is enabled */
+ const unsigned long long pud_mask = ~((1 << 30) - 1);
+ unsigned long long vaddr, lowest_vaddr = 0;
if (get_kernel_sym("page_offset_base") != 0) {
for(phdr = ehdr.e_phdr; phdr != end_phdr; phdr++) {
if (phdr->p_type == PT_LOAD) {
@@ -194,6 +195,7 @@ static int get_kernel_vaddr_and_size(struct kexec_info *UNUSED(info),
if (lowest_vaddr != 0)
elf_info->page_offset = lowest_vaddr;
}
+#endif
/* Traverse through the Elf headers and find the region where
* _stext symbol is located in. That's where kernel is mapped */
--
2.5.5
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2017-02-24 10:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 10:38 Baoquan He [this message]
2017-02-28 6:06 ` [PATCH] Only search page_offset_base when KASLR mm code is compiled in Dave Young
2017-03-02 9:36 ` Baoquan He
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=1487932732-24539-1-git-send-email-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=piliu@redhat.com \
/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