Kylinx: a Dynamic Library Operating System for Simplified and Efficient Cloud Virtualization
Total Page:16
File Type:pdf, Size:1020Kb
KylinX: A Dynamic Library Operating System for Simplified and Efficient Cloud Virtualization Yiming Zhang, NiceX Lab, NUDT; Jon Crowcroft, University of Cambridge; Dongsheng Li and Chengfen Zhang, NUDT; Huiba Li, Alibaba; Yaozheng Wang and Kai Yu, NUDT; Yongqiang Xiong, Microsoft; Guihai Chen, SJTU https://www.usenix.org/conference/atc18/presentation/zhang-yiming This paper is included in the Proceedings of the 2018 USENIX Annual Technical Conference (USENIX ATC ’18). July 11–13, 2018 • Boston, MA, USA ISBN 978-1-939133-02-1 Open access to the Proceedings of the 2018 USENIX Annual Technical Conference is sponsored by USENIX. KylinX: A Dynamic Library Operating System for Simplified and Efficient Cloud Virtualization Yiming Zhang Jon Crowcroft Dongsheng Li, Chengfei Zhang NiceX Lab, NUDT University of Cambridge NUDT Huiba Li Yaozheng Wang, Kai Yu Yongqiang Xiong Guihai Chen Alibaba NUDT Microsoft SJTU Abstract applications, while the current general-purpose OSs con- tain extensive libraries and features for multi-user, multi- Unikernel specializes a minimalistic LibOS and a tar- application scenarios. The mismatch between the single- get application into a standalone single-purpose virtual purpose usage of appliances and the general-purpose de- machine (VM) running on a hypervisor, which is referred sign of traditional OSs induces performance and security to as (virtual) appliance. Compared to traditional VMs, penalty, making appliance-based services cumbersome Unikernel appliances have smaller memory footprint and to deploy and schedule [62, 52], inefficient to run [56], lower overhead while guaranteeing the same level of and vulnerable to bugs of unnecessary libraries [27]. isolation. On the downside, Unikernel strips off the This problem has recently motivated the design of process abstraction from its monolithic appliance and Unikernel [56], a library operating system (LibOS) archi- thus sacrifices flexibility, efficiency, and applicability. tecture that is targeted for efficient and secure appliances This paper examines whether there is a balance em- in the clouds. Unikernel refactors a traditional OS into bracing the best of both Unikernel appliances (strong libraries, and seals the application binary and requisite isolation) and processes (high flexibility/efficiency). We libraries into a specialized appliance image which could present KylinX, a dynamic library operating system for run directly on a hypervisor such as Xen [30] and simplified and efficient cloud virtualization by providing KVM [22]. Compared to traditional VMs, Unikernel the pVM (process-like VM) abstraction. A pVM takes the appliances eliminate unused code, and achieve smaller hypervisor as an OS and the Unikernel appliance as a memory footprint, shorter boot times and lower overhead process allowing both page-level and library-level dy- while guaranteeing the same level of isolation [56]. The namic mapping. At the page level, KylinX supports pVM hypervisor’s steady interface avoids hardware compati- fork plus a set of API for inter-pVM communication (IpC). bility problems encountered by early LibOSs [39]. At the library level, KylinX supports shared libraries to be linked to a Unikernel appliance at runtime. KylinX On the downside, Unikernel strips off the process enforces mapping restrictions against potential threats. abstraction from its statically-sealed monolithic appli- KylinX can fork a pVM in about 1.3 ms and link a library ances, and thus sacrifices flexibility, efficiency, and to a running pVM in a few ms, both comparable to process applicability. For example, Unikernel cannot support fork on Linux (about 1 ms). Latencies of KylinX IpCs dynamic fork, a basis for commonly-used multi-process are also comparable to that of UNIX IPCs. abstraction of conventional UNIX applications; and the compile-time determined immutability precludes run- time management such as online library update and 1 Introduction address space randomization. This inability has largely reduced the applicability and performance of Unikernel. Commodity clouds (like EC2 [5]) provide a public plat- In this paper, we examine whether there is a balance form where tenants rent virtual machines (VMs) to run embracing the best of both Unikernel appliances (strong their applications. These cloud-based VMs are usually isolation) and processes (high flexibility/efficiency). We dedicated to specific online applications such as big data draw an analogy between appliances on a hypervisor and analysis [24] and game servers [20], and are referred to processes on a traditional OS and take one step forward as (virtual) appliances [56, 64]. The highly-specialized, from static Unikernels to present KylinX, a dynamic single-purpose appliances need only a very small portion library operating system for simplified and efficient of traditional OS support to run their accommodated cloud virtualization by providing the pVM (process-like USENIX Association 2018 USENIX Annual Technical Conference 173 VM) abstraction. We take the hypervisor as an OS and VM the appliance as a process allowing both page-level and Process picoprocess Application Code library-level dynamic mapping for pVM. Application Code Application Libs At the page level, KylinX supports pVM fork plus a Application Libs Process‐like VM (pVM) Language Runtime set of API for inter-pVM communication (IpC), which is Language Runtime Application Code OS Kernel Dynamic LibOS compatible with conventional UNIX inter-process com- LibOS and Runtime munication (IPC). The security of IpC is guaranteed by Hypervisor Host OS Hypervisor (as an OS) only allowing IpC between a family of mutually-trusted pVMs forked from the same root pVM. Figure 1: Alternative virtualization architectures. At the library level, KylinX supports shared libraries to be dynamically linked to a Unikernel appliance, en- abling pVMs to perform (i) online library update which lity for guests to run a complete OS, but it is costly replaces old libraries with new ones at runtime and (ii) due to duplicated and vestigial OS components. recycling which reuses in-memory domains for fast boot- VMs (Fig. 1(left)) have been widely used in multi- ing. We analyze potential threats induced by dynamic tenant clouds since it guarantees strong (type-1- mapping and enforce corresponding restrictions. hypervisor) isolation [55]. However, the current virtu- We have implemented a prototype of KylinX based alization architecture of VMs is heavy with layers of on Xen [30] (a type-1 hypervisor) by modifying Mini- hypervisor, VM, OS kernel, process, language runtime OS [14] (a Unikernel LibOS written in C) and Xen’s (such as glibc [16] and JVM [21]), libraries, and applica- toolstack. KylinX can fork a pVM in about 1.3 ms and link tion, which are complex and could no longer satisfy the a library to a running pVM in a few ms, both comparable efficiency requirements of commercial clouds. to process fork on Linux (about 1 ms). Latencies of Containers (like LXC [9] and Docker [15]) leverage KylinX IpCs are also comparable to that of UNIX IPCs. kernel features to package and isolate processes. They Evaluation on real-world applications (including a Redis are recently in great demand [25, 7, 6] because they server [13] and a web server [11]) shows that KylinX are lightweight compared to VMs. However, containers achieves higher applicability and performance than static offer weaker isolation than VMs, and thus they often run Unikernels while retaining the isolation guarantees. in VMs to achieve proper security guarantees [58]. The rest of this paper is organized as follows. Sec- Picoprocesses [38] (Fig. 1 (center)) could be viewed tion 2 introduces the background and design options. as containers with stronger isolation but lighter-weight Section 3 presents the design of dynamically-customized host obligations. They use a small interface between the KylinX LibOS with security restrictions. Section 4 host OSs and the guests to implement a LibOS realizing reports the evaluation results of the KylinX prototype the host ABI and map high-level guest API onto the small implementation. Section 5 introduces related work. And interface. Picoprocesses are particularly suitable for Section 6 concludes the paper and discusses future work. client software delivery because client software needs to run on various host hardware and OS combinations [38]. 2 Preliminaries They could also run on top of hypervisors [62, 32]. Recent studies [67, 32, 54] on picoprocesses relax 2.1 VMs, Containers & Picoprocesses the original static isolation model by allowing dynamics. For example, Graphene [67] supports picoprocess fork There are several conventional models in the literature of and multi-picoprocess API, and Bascule [32] allows OS- virtualization and isolation: processes, Jails, and VMs. independent extensions to be attached to a picoprocess at runtime. Although these relaxations dilute the strict • OS processes. The process model is targeted for isolation model, they effectively extend the applicability a conventional (partially-trusted) OS environment, of picoprocesses to a much broader range of applications. and provides rich ABI (application binary interface) and interactivity that make it not suitable for truly adversarial tenants. 2.2 Unikernel Appliances • FreeBSD Jails [47]. The jail model provides a Process-based virtualization and isolation techniques lightweight mechanism to separate applications and face challenges from the broad kernel syscall API that their associated policies. It runs a process on a is used to interact with the