The VX32 Virtual Extension Environment

Bryan Ford
Russ Cox

Computer Science and Artificial Intelligence Laboratory
Massachusetts Institute of Technology

Introduction

VX32 is a user-mode library that can be linked into arbitrary applications that wish to create secure, isolated execution environments in which to run untrusted extensions or plug-ins implemented as native x86 code. VX32 is thus conceptually comparable in purpose to a Java virtual machine or a C# language runtime, except that since it runs native x86 code. VX32-based application extensions can therefore be written in ANY language, including C and C++, not just type-safe languages such as Java or C#.

The VX32 distribution (below) comes with a "sample application", vxrun, that may be useful in its own right. The vxrun utility runs an arbitrary x86 executable compiled for VX32 in an extremely simple "Unix filter" environment, which gives the program the ability to read stdin and write stdout and stderr, but not to do anything else (such as opening other files, accessing the network, or even determining the current time or host OS type). This sample VX32 environment provides a safe and very simple native code extension mechanism that can be used easily from shell scripts or other programs. The vxrun filter environment, while rudimentary, may be sufficient for many practical purposes such as transcoding data streams on demand in web servers without running the risk of transcoder bugs compromising the whole web server.

The VX32 distribution also comes with a Linux binary emulator vxlinux that can run single-threaded Linux binaries that are not linked with TLS-aware C libraries.

A more specialized application that uses VX32 is the VXA ("Virtual eXecutable Archives") archive system.

Getting the Code

VX32 is currently at a very early, highly experimental stage: it is lacking in many ways, and no doubt has many bugs. It currently runs on Linux for x86-32 and x86-64, and on FreeBSD for x86-32; other ports will happen as I or others get around to doing them. USE AT YOUR OWN RISK!

Source code for current release: vx32-0.02.tar.bz2

Older release: vx32-0.01.tar.bz2

Cross-compiler binaries, if you don't want to compile them yourself as per the instructions in the README in the vx32 tree:

These were built for vx32-0.01 and may or may not work with vx32-0.02.

Documentation

Not much yet! Read the README file in the source release for starters, then look at VX32 library's public header files in the libvx32 directory and the code for the vxrun sample application in vxrun/vxrun.c.

There is the beginnings of a specification for the VX32 architecture in the doc/vx32 directory of the source release - i.e., a specification of exactly which parts of x86 are accessible to VX32 applications and which (such as segmentation-related instructions) are disallowed. It also has some stuff related to making the architecture more deterministic, which is not yet implemented in the VX32 library but on the road map.

For more high-level information about VXA and VX32 please see this paper:

Contact Info

For questions, comments, or improvements, contact Bryan Ford, baford (at) mit (dot) edu.

Related Links