My VM is Lighter (and Safer) than your Container

Introduction 背景 容器(Docker/LXC)在工业界广泛应用: Google, AWS, Azure, GCP 都依赖容器; 容器优势: 快速实例化(毫秒~百毫秒) 高密度运行(单机可数千~上万实例) 内存占用小, 镜像体积小 问题 安全性不足: 容器暴露 400+ syscalls, 内核攻击面巨大; 隔离性不如 VM, 常需要"容器运行在 VM 内"来补强; 资源滥用(fork bomb, 文件描述符耗尽)可导致宿主机 DoS; 目标 结合容器的轻量性与 VM 的强隔离; 需求: 毫秒级实例化 高密度运行 小镜像/低内存占用 快速挂起/恢复 保持 VM 的硬件隔离安全性 贡献 分析 Xen 性能瓶颈, 重构控制面: 移除 XenStore (noxs), 消除中心化瓶颈; 新工具链 chaos/libchaos + split toolstack; 提出 Tinyx 工具, 生成极小 Linux VM; 支持 unikernel; 实现 LightVM ...

2025-09-23 · 10 min · Yuchen You

The Turtles Project: Design and Implementation of Nested Virtualization

Authors: Muli Ben-Yehuda et al., IBM Research / IBM Linux Technology Center 1. 背景与动机 传统虚拟化 (single-level): 一个 hypervisor (L0) 管理多个 VM, 每个 VM 运行 OS; 嵌套虚拟化 (nested virtualization): 允许一个 hypervisor (L1) 作为 guest 运行, 并且还能继续运行自己的 VM (L2); 需求来源: 现代操作系统自带虚拟化功能(Windows XP mode in Win7, Linux 内置 KVM); IaaS 场景: 云提供商 (L0) 希望用户能运行自己的 hypervisor (L1), 自己管理 VM (L2); 研究和测试: 嵌套虚拟化方便调试/benchmark hypervisor; 安全性: 可以研究/防御 hypervisor-level rootkit; IaaS (Infrastructure as a Service) 云计算三层服务之一: IaaS / PaaS / SaaS; IaaS = 提供虚拟化的计算资源(VM, 存储, 网络); 例子: AWS EC2: 创业公司快速租用 VM, 按需扩展; Google Cloud GPU: 科研人员租用 A100 GPU VM; 与论文关系: 云提供商必须支持 nested virtualization, 才能让用户在 VM 内运行自己的 hypervisor; 2. 虚拟化理论基础 Popek–Goldberg (1974) 三大条件: 等价性 (equivalence), 资源控制 (resource control), 效率 (efficiency); 定理: 如果架构中所有 sensitive 指令 都是 privileged 指令, 则该架构是可虚拟化的; 影响: 解释了早期 x86 不可完全虚拟化 $\rightarrow$ VMware 使用二进制翻译绕过; 推动了 Intel/AMD 添加 VT-x / SVM 硬件扩展; 3. 两种嵌套虚拟化模型 1) Multi-level support 硬件直接支持多层 hypervisor; Trap 从 L2 直接交给 L1; 例子: IBM System z; 高效, 但硬件设计复杂; 且一般多层的支持都是有限的, 如只支持两层, 这篇论文是在理论上支持任意层数的嵌套虚拟化, 因此更高层的虚拟化实际上还是依赖于单层虚拟化的软件支持逻辑: compress 2) Single-level support 硬件只有一层 root mode (L0); 所有 trap(无论来自 L1, L2, L3)都掉到 L0; L0 决定是否转发给 L1; 例子: x86 的 Intel VT-x (VMX), AMD SVM; Multiplexing single-level: L0 将唯一的一层虚拟化能力"复用", 对上层 L1/L2 进行模拟; 4. CPU 虚拟化 (VMX) VMX & L0 VMX = Intel VT-x 的指令扩展集; L0 = 唯一运行在 VMX root mode 的 hypervisor; 所有 VMExit/VMEntry 都必须经过 L0; Trap 流程: Single-level support: L2 trap $\rightarrow$ L0 trap handler $\rightarrow$ L0 转发给 L1; ...

2025-09-22 · 4 min · Yuchen You

A Comparison of Software and Hardware Techniques for x86 Virtualization

The main technical contributions of this paper are: a review of VMware Workstation’s software VMM, focusing on performance properties of the virtual instruction execution engine; a review of the emerging hardware support, identifying performance trade-offs; a quantitative performance comparison of a software and a hardware VMM. Establishes three essential characteristics for system software to be considered a VMM Fidelity(保真性) Software on the VMM executes identically to its execution on hardware, barring timing effects. Performance(高性能) An overwhelming majority of guest instructions are executed by the hardware without the intervention of the VMM. Safety(安全性) The VMM manages all hardware resources. 1. 基础概念 VMM vs Hypervisor VMM (Virtual Machine Monitor): 来自 Popek & Goldberg (1974), 强调核心虚拟化功能(trap & emulate, BT, shadow structures); 负责虚拟机执行控制; Hypervisor: 工程上更常用的术语, 指整个虚拟化层; 包含 VMM, 同时提供调度, 资源分配, 设备模型, 管理接口; Type 1(bare-metal, 如 Xen, ESXi), Type 2(hosted, 如 VMware Workstation); ...

2025-09-21 · 5 min · Yuchen You

Xen and the Art of Virtualization

背景 应用设计需要一个稳定的环境, 而传统的 OS 隔离技术不足以支持这种要求, 比如一个程序消耗了大量的算力并且被 scheduler 赋予了非常高的优先级, 或者系统被程序攻击了, 从而被某个其他进程消耗了很多资源导致当前进程的性能受损, 因此需要更高层的 VM 设计来实现工业界需要的 isolation 级别 ...

2025-09-15 · 10 min · Yuchen You