kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
Subsystems (2)
PATCH 1/1 kexec-tools/x86: get_kernel_vaddr_and_size off-by-one fix
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.
--- kexec/arch/i386/crashdump-x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/i386/crashdump-x86.c +1 -1
@@ -205,7 +205,7 @@ static int get_kernel_vaddr_and_size(strunsigned 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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 12 lines · Dave Young
I got below error while tesing kexec -p:
"Can't find kernel text map area from kcore"The case is the
pt_loadstart addr was same asstext_sym. The checking code should really be saddr <=stext_symso that the rightpt_loadarea includesstext_symcan be matched.This was not reported by people previously because it will fail over to use hardcode
X86_64__START_KERNEL_mapto match thept_loadareas again in later code and it sometimes succeeds because of kernel address randomization.
Quoted 4 lines
With this change according to my test
stext_symchecking can garantee falling into rightpt_loadarea if we get correctstext_sym.Signed-off-by Dave Young <[email protected]>
Thanks, applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec