Page 1 of 1

New design for Virtual kernel VM

Posted: Wed Dec 29, 2010 7:52 pm
by arjo129
I was planning on developing a VM that runs an x86_64 linux kernel inside my current OS. I want the VM to be some what like this:
The guest OS has direct access to all the hard ware except for storage devices and ram, these shall be virtuallized via the VM. The filesystem and ram are emulated by the OS. The main reason I want the guest kernel to have access to the hardware is so that I do not need to redo the drivers. Virtuallising the FS and RAM is done so that I can create a simple versioning system that allows me to backup the guest OS FS without any issues. How do you think I should go about doing this :?: .

Re: New design for Virtual kernel VM

Posted: Thu Dec 30, 2010 9:50 am
by NickJohnson
Allowing an OS in a VM access to all hardware is not a good idea. Not only will DMA not work due to the layer of paging the guest OS does not know about, but it is also a security and stability problem. Also, how do you know which ports correspond to storage devices and which don't?

Re: New design for Virtual kernel VM

Posted: Thu Dec 30, 2010 11:32 am
by bluemoon
On the other hand, I guess most design allow direct access to RAM for performance reason instead of emulation.
(I'm not sure but It may be done with some tricky hook and checks for mapping pages and hijack CR3/invlpg/etc).

By the way, if your VM is going to provide direct hardware access, you probably going to upset the host OS.
However, you may consider running your VM on bare metal, like VMWare ESX; so at least your VM can access most hardware directly.

Re: New design for Virtual kernel VM

Posted: Thu Dec 30, 2010 7:30 pm
by arjo129
Yeah I'll run it on baremetal, also I'll keep it in real mode so the bootloader. Kind of like VMware ESX except it'll run only one OS. I'll have alook at KVM's source code for the paging issue.
NickJohnson wrote:Allowing an OS in a VM access to all hardware is not a good idea. Not only will DMA not work due to the layer of paging the guest OS does not know about, but it is also a security and stability problem. Also, how do you know which ports correspond to storage devices and which don't?
Before loading the system I shall have figured which ports correspond to storage devices.

Re: New design for Virtual kernel VM

Posted: Sat Jan 01, 2011 7:05 am
by Combuster
"Because I (will) know" is not a valid argument :wink:

Re: New design for Virtual kernel VM

Posted: Sat Jan 01, 2011 8:39 pm
by arjo129
From what I figured out I have two options for doing what I wanted. I could para-virtuallize the linux kernel on top of my own, or I could emulate the CPU and HDD.