* [patch] KVM: fix hypercall cache/decache
@ 2007-03-20 8:54 Ingo Molnar
[not found] ` <20070320085427.GA21948-X9Un+BFzKDI@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2007-03-20 8:54 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
Subject: [patch] KVM: fix hypercall cache/decache
From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
a recent change to kvm_hypercall() flipped around the order of
->cache_regs() and ->decache_regs(), but that is bogus and causes
ESP/RIP corruption: ->cache_regs() will 'cache' the CPU-side registers
into the vcpu structure, and ->decache_regs() will sync it back to the
CPU.
fix this by using the correct order again.
Signed-off-by: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
---
drivers/kvm/kvm_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: linux/drivers/kvm/kvm_main.c
===================================================================
--- linux.orig/drivers/kvm/kvm_main.c
+++ linux/drivers/kvm/kvm_main.c
@@ -1177,7 +1177,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu,
{
unsigned long nr, a0, a1, a2, a3, a4, a5, ret;
- kvm_arch_ops->decache_regs(vcpu);
+ kvm_arch_ops->cache_regs(vcpu);
ret = -KVM_EINVAL;
#ifdef CONFIG_X86_64
if (is_long_mode(vcpu)) {
@@ -1204,7 +1204,8 @@ int kvm_hypercall(struct kvm_vcpu *vcpu,
;
}
vcpu->regs[VCPU_REGS_RAX] = ret;
- kvm_arch_ops->cache_regs(vcpu);
+ kvm_arch_ops->decache_regs(vcpu);
+
return 1;
}
EXPORT_SYMBOL_GPL(kvm_hypercall);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] KVM: fix hypercall cache/decache
[not found] ` <20070320085427.GA21948-X9Un+BFzKDI@public.gmane.org>
@ 2007-03-20 9:21 ` Avi Kivity
[not found] ` <45FFA790.7080007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-03-20 9:21 UTC (permalink / raw)
To: Ingo Molnar; +Cc: kvm-devel
Ingo Molnar wrote:
> Subject: [patch] KVM: fix hypercall cache/decache
> From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
>
> a recent change to kvm_hypercall() flipped around the order of
> ->cache_regs() and ->decache_regs(), but that is bogus and causes
> ESP/RIP corruption: ->cache_regs() will 'cache' the CPU-side registers
> into the vcpu structure, and ->decache_regs() will sync it back to the
> CPU.
>
> fix this by using the correct order again.
>
>
That's 57d78025d84fb607aa335d015a79b257517aa209 in my tree...
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] KVM: fix hypercall cache/decache
[not found] ` <45FFA790.7080007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-20 9:25 ` Ingo Molnar
0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2007-03-20 9:25 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
> Ingo Molnar wrote:
> >Subject: [patch] KVM: fix hypercall cache/decache
> >From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
> >
> >a recent change to kvm_hypercall() flipped around the order of
> >->cache_regs() and ->decache_regs(), but that is bogus and causes
> >ESP/RIP corruption: ->cache_regs() will 'cache' the CPU-side registers
> >into the vcpu structure, and ->decache_regs() will sync it back to the
> >CPU.
> >
> >fix this by using the correct order again.
>
> That's 57d78025d84fb607aa335d015a79b257517aa209 in my tree...
ok :)
Ingo
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-20 9:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20 8:54 [patch] KVM: fix hypercall cache/decache Ingo Molnar
[not found] ` <20070320085427.GA21948-X9Un+BFzKDI@public.gmane.org>
2007-03-20 9:21 ` Avi Kivity
[not found] ` <45FFA790.7080007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-20 9:25 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox