Re: [x86] - technical questions about HV implementation on Intel VT

Eric Lacombe
2009-04-29T16:13:56Z

Yeah, I got it! All seems to work well now ;)

It was simply the host_cr3 field that I did not correctly fill...
When I started to write my module, I used the cr3 of the current process to
fill the host_cr3 VMCS field .... big mistake !!! as the process (insmod) dies
after loading my module, the corresponding page where my host_cr3 field points
is then invalid. And that's why when I tried to execute a command that is not
a built-in command (which induced more allocations), the system went crazy, as
my host_cr3 page was then used for something else...

Thank you anyway to have spent some time on my problem.

Best regards,

Eric

Le mercredi 29 avril 2009 16:50:15 Eric Lacombe, vous avez écrit :
> Hi,
>
> Le mardi 21 avril 2009 13:16:06 Eric Lacombe, vous avez écrit :
> > Le lundi 20 avril 2009 20:22:21 Avi Kivity, vous avez écrit :
> > > Eric Lacombe wrote:
>
> [...]
>
> > > echo and pwd are part of bash, so they are probably in memory. I guess
> > > once you go to disk things fail.
> > >
> > > Try to boot the entire OS from initramfs (and keep it there).
> >
> > I will try this but maybe what follows say that the problem is elsewhere.
>
> I setup a minimal initramfs with busybox and my module inside.
> The init script in the initramfs only mount /proc /sys, populate /dev
> (busybox mdev), then execute the busybox shell.
>
> Then when I insmod'ed my module, I had to cope with an exit reason at the
> very first entry (through vmlaunch) to the VM.
> This was because of the host and guest fs_selector VMCS fields, whose TI
> and RPL bits were not 0.
>
> After fixing that (setting TI and RPL bits to 0, instead of using directly
> fs and gs values), the vmlaunch succeed, and I got quite the same behaviour
> as when the system boots with the rootfs pointing to the hard disk, i.e.
> the system works for "echo", "pwd", ... but freezes after a ls for example.
>
> I say "quite", as I sometime got a freeze after a "echo something".
> So the problem is definitely not a problem with files on the hard disk...
>
> Do you have some new hints on what could go wrong?
> And what could I try to resolve this problem?
>
> I really need to resolve that thing, and all assistance is more than
> greatly welcome ;)
>
> Thanks in advance for your response and the time you have already spent to
> help me.
>
> Eric Lacombe