New design for Virtual kernel VM

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
arjo129
Posts: 21
Joined: Mon May 03, 2010 10:19 pm
Location: Asia, Planet Earth, Solar system, Milky way

New design for Virtual kernel VM

Post 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 :?: .
Zephirum OS- Super secure http://code.google.com/p/zephirum-server/
Number of blue screens of death I have seen: 19
Number of apple OS X kernel panics I have seen: 2
Number of linux kernel panics I have seen: 0
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: New design for Virtual kernel VM

Post 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?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: New design for Virtual kernel VM

Post 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.
arjo129
Posts: 21
Joined: Mon May 03, 2010 10:19 pm
Location: Asia, Planet Earth, Solar system, Milky way

Re: New design for Virtual kernel VM

Post 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.
Zephirum OS- Super secure http://code.google.com/p/zephirum-server/
Number of blue screens of death I have seen: 19
Number of apple OS X kernel panics I have seen: 2
Number of linux kernel panics I have seen: 0
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: New design for Virtual kernel VM

Post by Combuster »

"Because I (will) know" is not a valid argument :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
arjo129
Posts: 21
Joined: Mon May 03, 2010 10:19 pm
Location: Asia, Planet Earth, Solar system, Milky way

Re: New design for Virtual kernel VM

Post 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.
Zephirum OS- Super secure http://code.google.com/p/zephirum-server/
Number of blue screens of death I have seen: 19
Number of apple OS X kernel panics I have seen: 2
Number of linux kernel panics I have seen: 0
Post Reply