* [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
@ 2016-12-08 2:52 Dave Young
2016-12-08 10:04 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Dave Young @ 2016-12-08 2:52 UTC (permalink / raw)
To: horms; +Cc: kexec
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
2016-12-08 2:52 [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix Dave Young
@ 2016-12-08 10:04 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2016-12-08 10:04 UTC (permalink / raw)
To: Dave Young; +Cc: kexec
On Thu, Dec 08, 2016 at 10:52:22AM +0800, Dave Young wrote:
> 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>
Thanks, applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-08 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 2:52 [PATCH] kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix Dave Young
2016-12-08 10:04 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox