Table of Contents

ICA: Safe Binary Device Driver Reuse via User-level Binary Translation

The Problems

The maturity of new operating systems heavily depends on the enrichment and diversity of device drivers, which account for about 70% of commodity OS code base. Thus, it usually takes the major development and testing effort to support and integrate device drivers into a new OS. The general solution is to reuse the device drivers from a driver-rich OS (e.g. Linux or Windows). The hardware manufacturers, however, usually only provide binary drivers to most commercial OS. Even if the source code is available, developers still need to carefully modify the drivers to handle the interface diversity. Meanwhile, device drivers in commodity OS usually execute in most privileged level and are responsible for up to 70% of system failures.

LeVaseur et al. propose to use virtual machines (VMs) to reuse and isolate device drivers by executing them within separate VMs. However, such an approach still requires to host the original OS and consumes resources significantly beyond those that a driver requires. Further, it still requires adapting the original device drivers to use the newly exposed interfaces. Finally, it does not support the reuse of drivers across different ISAs.

Approaches

Being aware of the limitations of existing solutions, we propose to use dynamic binary translation to cross-ISA reuse binary device drivers, and improve system dependability through encapsulating the driver within a user mode process. The basic idea is transplanting device drivers at the binary level and using a glue layer to emulate the interfaces of the original OS.

Figure 1:Architecture of device driver reuse and isolation using binary translation.

Figure 1 illustrates the architecture of our driver reuse scheme. A shim layer is provided to execute the binary drivers in user mode, which consists of a dynamic binary translator (libdbt), multiple kernel service libraries (libksrv), and a user-space driver manager (libdrv-mgr).

The libdbt translates instructions of reused drivers from the original ISA to the host ISA. The libksrv emulates the kernel services of the original OS used by the drivers using services in the host OS. The libdrv-mgr glues the drivers and the service libraries to ensure that the drivers only invoke external functions provided by the libksrv. It is also responsible for the communication with the general driver module (libdrv-mod), which mediates the accesses to kernel resources and hardware devices, and handles the interactions with applications.

For commodity OSes such as Windows, the device driver model usually adopts a layered design, which usually consists of driver layers such as class, port, and miniport drivers. To support such a hierarchy, the libdbt loads and translates the entire driver layers and the libksrv emulates the low-level kernel services (e.g. memcpy), which are relatively similar among multiple OSes.

Early-stage Prototype

An early-stage prototype based qemu-0.11.0 runs on an Intel x86 machine to support the reuse of same-ISA binary device drivers from Windows XP to Linux. We are also working to cross-ISA reuse drivers from x86 to an ARM-like processors. Approximately 161 interfaces within libksrv need to be implemented to support the drivers of the network card and the sound card. Currently, we have extended qemu and developed the libdrv-mgr, libdrv-mod to sucessefully initialize a network driver and a sound driver for Windows on Linux. A lot of code within libksrv and libdrv-mod could be directly reused from the host kernel source tree or multiple open source projects (e.g. Wine and ReactOS).

Publications