]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
contrib/elf2dmp: add kernel start address checking
authorViktor Prutyanov <viktor.prutyanov@phystech.edu>
Tue, 19 Feb 2019 21:19:36 +0000 (00:19 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 11 Mar 2019 15:33:49 +0000 (16:33 +0100)
Before this patch, if elf2dmp failed to find NT kernel PE magic in
allowed virtual address range, then it assumes NULL as NT kernel
address and cause segfault.

This patch fix the problem described above by checking NT kernel address
before futher processing.

Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Message-Id: <20190219211936.6466-1-viktor.prutyanov@phystech.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
contrib/elf2dmp/main.c

index 1a45eaf565dc198abec52bf7a9b2103d0f209ab1..1bfeb89ba7bdeccfe707a6e6cf0267d3e3a9b8da 100644 (file)
@@ -524,6 +524,12 @@ int main(int argc, char *argv[])
         }
     }
 
+    if (!nt_start_addr) {
+        eprintf("Failed to find NT kernel image\n");
+        err = 1;
+        goto out_ps;
+    }
+
     printf("KernBase = 0x%016"PRIx64", signature is \'%.2s\'\n", KernBase,
             (char *)nt_start_addr);