qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] contrib/elf2dmp: add kernel start address checking
@ 2019-02-19 21:19 Viktor Prutyanov
  2019-02-20 11:30 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Viktor Prutyanov @ 2019-02-19 21:19 UTC (permalink / raw)
  To: peter.maydell; +Cc: pbonzini, rkagan, qemu-devel, Viktor Prutyanov

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>
---
 contrib/elf2dmp/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);
 
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-09  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19 21:19 [Qemu-devel] [PATCH] contrib/elf2dmp: add kernel start address checking Viktor Prutyanov
2019-02-20 11:30 ` Paolo Bonzini
2019-03-08 17:55   ` Peter Maydell
2019-03-09  7:49     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).