All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nested SVM: don't run into endless loop
@ 2008-12-18 12:30 Alexander Graf
  2008-12-23 17:53 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2008-12-18 12:30 UTC (permalink / raw)
  To: kvm

With the emulation optimization after clgi, we can potentially
run into an endless loop thanks to while(true).

While this should never occur in practise, except for when
the emulation is broken or really awkward code is executed in
the VM, this wasn't a problem so far.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/x86/kvm/svm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index f67ca16..bf901e7 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1848,6 +1848,8 @@ static int stgi_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
 
 static int clgi_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
 {
+	int loopcount = 0;
+
 	if (nested_svm_check_permissions(svm))
 		return 1;
 
@@ -1862,7 +1864,7 @@ static int clgi_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
 
 	/* Let's try to emulate as many instructions as possible in GIF=0 */
 
-	while(true) {
+	while(++loopcount < 100) {
 		int er;
 
 		er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0);
-- 
1.5.6


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

* Re: [PATCH] nested SVM: don't run into endless loop
  2008-12-18 12:30 [PATCH] nested SVM: don't run into endless loop Alexander Graf
@ 2008-12-23 17:53 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-12-23 17:53 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm

Alexander Graf wrote:
> With the emulation optimization after clgi, we can potentially
> run into an endless loop thanks to while(true).
>
> While this should never occur in practise, except for when
> the emulation is broken or really awkward code is executed in
> the VM, this wasn't a problem so far.
>
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2008-12-23 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 12:30 [PATCH] nested SVM: don't run into endless loop Alexander Graf
2008-12-23 17:53 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.