Forum > Third party

Running code in the context of a VM by using KVM API from Freepascal

(1/1)

z0rr0:
Hello everyone,

for those that are interesting in creating Virtual Machines by using the KVM API, I just committed a simple example at https://github.com/MatiasVara/kvmtest. This repository includes the unit "Kvm.pas" that allows a program to run a piece of assembly code, i.e., guest.s, in the context of a VM. The user program ("main.pas" in the repository) acts as a Virtual Machine Monitor(VMM) that traps VMEXIT.

Cheers,
Matias

MarkMLl:
That looks interesting, but could you expand a bit on what the objective is and what's actually being run? Also you appear to be building for Linux and (obviously) assuming the availability of KVM, but are there any other OS etc. requirements?

MarkMLl

z0rr0:
Hello MarkMLI,

--- Quote from: MarkMLl on May 02, 2021, 09:43:44 pm ---That looks interesting, but could you expand a bit on what the objective is and what's actually being run? Also you appear to be building for Linux and (obviously) assuming the availability of KVM, but are there any other OS etc. requirements?

MarkMLl

--- End quote ---

This demo is based on the article https://lwn.net/Articles/658511/. The goal of this simple demo is to show the use of KVM to run a piece of assembly code in the context of a Virtual Machine. To do this, a user program first loads the binary and then interacts with KVM to create a VM that will execute that binary. The binary executes as a KVM guest in 64 bits but without any device. The user program acts as QEMU does, i.e., a virtual machine monitor. Some operations that the guest does are trapped by the user program that hosts it. For example, this happens when the guest tries to access to an ioport. I will add this information to the README.md to make it clear.

Matias     

Navigation

[0] Message Index

Go to full version