summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Prutyanov2019-02-19 22:19:36 +0100
committerPaolo Bonzini2019-03-11 16:33:49 +0100
commit06164cc402e67e64eefb79cd9a00a59d0e0d2fce (patch)
tree259e09fb959256437386c1c9d7d114b102807168
parentblock/iscsi: Restrict Linux-specific code (diff)
downloadqemu-06164cc402e67e64eefb79cd9a00a59d0e0d2fce.tar.gz
qemu-06164cc402e67e64eefb79cd9a00a59d0e0d2fce.tar.xz
qemu-06164cc402e67e64eefb79cd9a00a59d0e0d2fce.zip
contrib/elf2dmp: add kernel start address checking
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>
-rw-r--r--contrib/elf2dmp/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index 1a45eaf565..1bfeb89ba7 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -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);