Skip to contentSkip to conversation

kvm: Dump guest rIP when the guest tried something unsupported

PATCH In review Borislav Petkov 2 participants 2 messages Nov 20, 2015 – Dec 4, 2015 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: Dump guest rIP when the guest tried something unsupported

From: Borislav Petkov <[email protected]>

It looks like this in action:

kvm [5197]: vcpu0, guest rIP: 0xffffffff810187ba unhandled rdmsr: 0xc001102

and helps to pinpoint quickly where in the guest we did the unsupported thing.

---
 include/linux/kvm_host.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/kvm_host.h +2 -1
index 5706a2108f0a..597f6607c440 100644
@@ -439,7 +439,8 @@ struct kvm {
 
 /* The guest did something we don't support. */
 #define vcpu_unimpl(vcpu, fmt, ...)					\
-	kvm_pr_unimpl("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
+	kvm_pr_unimpl("vcpu%i, guest rIP: 0x%lx " fmt,			\
+			(vcpu)->vcpu_id, kvm_rip_read(vcpu), ## __VA_ARGS__)
 
 #define vcpu_debug(vcpu, fmt, ...)					\
 	kvm_debug("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
Signature · 1 line
2.3.5
maintainer
#1 lore raw
Quoted 20 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

It looks like this in action:

kvm [5197]: vcpu0, guest rIP: 0xffffffff810187ba unhandled rdmsr: 0xc001102

and helps to pinpoint quickly where in the guest we did the unsupported thing.

---
 include/linux/kvm_host.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/kvm_host.h +0 -0
index 5706a2108f0a..597f6607c440 100644

include/linux/kvm_host.h struct kvm { · line 446

Quoted 9 lines
include/linux/kvm_host.h +2 -1
@@ -439,7 +439,8 @@ struct kvm {
 
 /* The guest did something we don't support. */
 #define vcpu_unimpl(vcpu, fmt, ...)					\
-	kvm_pr_unimpl("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)
+	kvm_pr_unimpl("vcpu%i, guest rIP: 0x%lx " fmt,			\
+			(vcpu)->vcpu_id, kvm_rip_read(vcpu), ## __VA_ARGS__)
 
 #define vcpu_debug(vcpu, fmt, ...)					\
 	kvm_debug("vcpu%i " fmt, (vcpu)->vcpu_id, ## __VA_ARGS__)

Thanks, applying this to kvm/queue.

Paolo