A "Minimal Viable" Xen VMI learning project (Pure C).
Designed for education, minivmi demonstrates the raw interaction with Xen hypercalls (libxc, vm_event) without the complexity of heavy abstraction libraries. It aims to be the "Hello World" for Xen Virtual Machine Introspection.
It performs three simple tasks to illustrate the VMI lifecycle:
- List Domains: Enumerate active domains (
list_domains). - Attach: Map the guest memory and prepare for introspection (UUID based).
- Monitor: Enable
vm_eventto trap CR3 (Context Switch) events and print them (cr3trace_uuid).
The project uses pkg-config to automatically handle compiler flags for:
xencontrol(libxc)xenstorexenevtchn
一个“最小可用”的 Xen VMI 学习项目(纯 C),只做三件事:
- 第1步:列出 domain(
list_domains) - 第2步:按 UUID attach 到某个 HVM guest(
cr3trace_uuid的准备阶段) - 第3步:开启 vm_event 的 CR3 写入监控并打印事件(
cr3trace_uuid)
所有生成物都在 _build/(已在 .gitignore 忽略)。
make如果系统有 pkg-config,Makefile 会用这些包名自动取编译/链接参数:
xencontrol(libxc)xenstorexenevtchn
- 列出当前 domain:
sudo _build/bin/list_domains- 监控某个 guest 的 CR3 写入(推荐用 UUID):
sudo _build/bin/cr3trace_uuid --uuid <guest-uuid>按 Ctrl+C 退出。