[Lguest] [PATCH 4/5] lguest: use KVM hypercalls

Matias Zabaljauregui zabaljauregui at gmail.com
Tue Apr 14 02:25:39 EST 2009


Hi,

On Thu, 2009-04-09 at 12:32 +0200, Simon Holm Thøgersen wrote:
> ons, 08 04 2009 kl. 17:58 -0300, skrev Matias Zabaljauregui:
> > Simon, Patrick,
> > 
> > On Wed, 2009-04-08 at 10:21 +0930, Rusty Russell wrote:
> > > On Tuesday 07 April 2009 04:19:58 Matias Zabaljauregui wrote:
> > > > But then, when it tries to re-execute the faulting instruction, which is
> > > > now patched with "cd 1f 90"  (int 0x1f, nop), it raises an invalid code
> > > > fault again, instead of doing the trap. 
> > > 
> > > COW on the page?  Perhaps try flushing all the shadow pagetables after a
> > > rewrite?
> > > 
> > > Rusty.
> > 
> > Rusty suggested that perhaps we need to flush all shadow after rewriting. 
> > Could you please try this patch?
> 
> Yes, it fixes the issue.

great, thanks for testing. 

> > 
> > BTW, shouldn't this also affect my test boxes if this were the case?
> > 
> Could be the timing differences between our boxes I guess?

I haven't read COW code, but I cannot figure out how CPU timing
differences could affect a logic driven by faults. I will investigate
further and let you know if I can yield any conclusion.

> 
> The compiler used seems to play a role as well, though. I compiled a
> kernel on another box and using that there was no problems even without
> the patch. If you are interested in testing the faulty kernel I could
> make it available to you.
> Simon


Regards, 

Matias









> > 
> > diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
> > index a6b7176..b4747f7 100644
> > --- a/drivers/lguest/x86/core.c
> > +++ b/drivers/lguest/x86/core.c
> > @@ -324,6 +324,7 @@ static void rewrite_hypercall(struct lg_cpu *cpu)
> >  	u8 insn[3] = {0xcd, 0x1f, 0x90};
> >  
> >  	__lgwrite(cpu, guest_pa(cpu, cpu->regs->eip), insn, sizeof(insn));
> > +	guest_pagetable_clear_all(cpu);
> >  }
> >  
> >  static bool is_hypercall(struct lg_cpu *cpu)
> 
> 




More information about the Lguest mailing list