Add tool to attempt to crash HVM guests
PATCH 1/1 Add tool to attempt to crash HVM guests
# HG changeset patch
# User Paul Durrant <[email protected]> # Date 1280326501 -3600
# Node ID c28224c0f0657aa29c1385f5711cccafbb2024d2 # Parent 4207549948a4c34b9e192635ec5b3b75a09dbf30 Add tool to attempt to crash HVM guests
This tool reads the CPU save records, overwrites RIP with a bogus value, and then restores them. This is, of course, not guaranteed to crash the guest (since the CPUs may not be executing in kernel at the time) but it's good for breaking into some tight loops that would be hard to debug otherwise.
tools/misc/Makefile +3 -3
@@ -11,7 +11,7 @@ HDRS = $(wildcard *.h) HDRS = $(wildcard *.h) TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd -TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx +TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y)
@@ -24,7 +24,7 @@ INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_BIN := $(INSTALL_BIN-y) INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd -INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx +INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool INSTALL_SBIN := $(INSTALL_SBIN-y)
@@ -51,7 +51,7 @@ clean: %.o: %.c $(HDRS) Makefile $(CC) -c $(CFLAGS) -o $@ $< -xen-hvmctx xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile +xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) gtraceview: %: %.o Makefile
tools/misc/xen-hvmcrash.c new file +143 -0
143 lines not on this page · raw message
Paul Durrant writes ("[Xen-devel] [PATCH] Add tool to attempt to crash HVM guests"):
Quoted 5 lines
This tool reads the CPU save records, overwrites RIP with a bogus value, and then restores them. This is, of course, not guaranteed to crash the guest (since the CPUs may not be executing in kernel at the time) but it's good for breaking into some tight loops that would be hard to debug otherwise.
Surely there must be a better way of doing this! Isn't it sufficient to pause the guest and then inspect it ? Or do we need a new domctl to crash the guest explicitly ?
Ian.
Quoted 11 lines · Ian Jackson
Paul Durrant writes ("[Xen-devel] [PATCH] Add tool to attempt to crash HVM guests"):
Quoted 5 lines
This tool reads the CPU save records, overwrites RIP with a bogus value, and then restores them. This is, of course, not guaranteed to crash the guest (since the CPUs may not be executing in kernel at the time) but it's good for breaking into some tight loops that would be hard to debug otherwise.
Surely there must be a better way of doing this! Isn't it sufficient to pause the guest and then inspect it ? Or do we need a new domctl to crash the guest explicitly ?
Explicitly crashing the guest can be very useful for testing, I had to use this tool myself few times...
Quoted 17 lines
-----Original Message-----
From: Ian Jackson
Sent: 29 July 2010 16:51
To: Paul Durrant
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] Add tool to attempt to crash HVM guestsPaul Durrant writes ("[Xen-devel] [PATCH] Add tool to attempt to crash HVM guests"):
Quoted 5 lines
This tool reads the CPU save records, overwrites RIP with a bogus value, and then restores them. This is, of course, not guaranteed to crash the guest (since the CPUs may not be executing in kernel at the time) but it's good for breaking into some tight loops that would be hard to debug otherwise.
Quoted 5 lines
Surely there must be a better way of doing this! Isn't it sufficient
to pause the guest and then inspect it ? Or do we need a new domctl to crash the guest explicitly ?
Ian,
Inspecting the guest from dom0 is of limited use since we have nothing running there to attach windbg too. Causing it to fallover in the way this tool does usually unlocks the kernel debugger polling loop and hence windbg can get a lookin over the emulated serial device. By 'crash the guest explicitly' what were you thinking?
Paul
Paul Durrant writes ("RE: [Xen-devel] [PATCH] Add tool to attempt to crash HVM guests"):
...
Quoted 5 lines
Inspecting the guest from dom0 is of limited use since we have nothing running there to attach windbg too. Causing it to fallover in the way this tool does usually unlocks the kernel debugger polling loop and hence windbg can get a lookin over the emulated serial device.
Oh, I see what you're trying to do. This makes more sense now.
Ian.