[LLVMdev] LLVM based Virtual Machine "Environment" idea sanity check.

John Criswell criswell at cs.uiuc.edu
Tue Sep 5 15:22:55 PDT 2006

Shawn "AutoDMC" Boles wrote:
> I've got an idea for a program, and after readig about 1/3 of your 
> documentation, I think LLVM is what I'm looking for.
> What I'd like now is some help to see if my idea is "sane" and and shed 
> light and direction that could be provided.
> I want to build a simplified "Virtual Machine" containing:
> A Terminal
> Hard Drives (image files)
> Some Kind Of Networking Device
> LLVM programs would be run "inside" this Virtual Machine, accessing the 
> terminal and hard drive images and networking device... but not having 
> access to ANYTHING on the host computer (except through the "virtual" 
> devices).
If you don't mind my asking, can you tell us a little more about your 
overall goal for this project?  How stringent is your isolation 
requirement?  What types of programs do you want to run on this VM 
(programs written in a special language, small C applications, a full 
operating system like Xen/VMWare, etc)?  LLVM can probably make 
development go faster, but the sanity of your project greatly depends on 
what it is for and just how much it will do.

> I had originally planned on writing my own "processor core" for this 
> project... but I'd rather use LLVM (Mainly because I don't have to write 
> my own high level tools).
I think LLVM would probably make a good "processor core" for the very 
reasons you mention.
> Here's what I'm thinking I need to do.  It seems to me that I have to 
> "port" LLVM using the System Library to my "Virtual Machine" (which also 
> includes a bit of magic of the "Exokernel" operating system stuff). 
> Then I can run LLVM programs in my "port" on my "environment" to get 
> what I want.
This doesn't make sense to me.  If you're going to build your virtual 
machine out of LLVM components, why would you make those components run 
on the virtual machine itself?
> Then LLVM can JIT compile programs but still only have access to my 
> "Virtual Machine."  I think.
The difficulty of this depends on the scope of your virtual machine.  
Unlike other bytecode languages, LLVM can represent programs with buffer 
overruns and type unsafe casts, both of which could undermine any 
restrictions that your VM places on programs that it runs.

Now, you could use LLVM to build a safe virtual machine, but you would 
have to figure out how to solve these problems. There are various 
solutions of varying degrees of sanity, but I can't really give any 
feedback on which is more appropriate until I know more about the 
constraints of your project.

-- John T.

> Any pointers on where to read, Ideas to move on... would be much 
> appreciated.
> Thanks.

More information about the llvm-dev mailing list