kvm-host is a minimalist type 2 hypervisor using Linux Kernel-based Virtual Machine (KVM), capable of running Linux kernel partially.

Overview

kvm-host

kvm-host is a minimalist type 2 hypervisor using Linux Kernel-based Virtual Machine (KVM), capable of running Linux kernel partially.

Build and Run

To compile:

make

Download and build Linux kernel from scratch:

make build/bzImage

Run Linux guest with kvm-host:

make check

Usage

kvm-host [bzImage]

bzImage is the Path to linux kernel bzImage. The bzImage file is in a specific format, containing concatenated bootsect.o + setup.o + misc.o + piggy.o.

License

kvm-host is released under the BSD 2 clause license. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

References

Issues
  • Support initrd loading to boot Linux

    Support initrd loading to boot Linux

    Does it make sense to support new features for this minimalist type 2 hypervisor? I have tried to support the loading of initrd for kvm-host. Until now, by setting the e820 memory map and load initrd to the right place, this patch makes the booting of Linux on kvm-host more progress.

    The following image shows the last message for the booting of Linux after this patch. What needs to be mentioned is that there's still many warning/error happened during the booting process, we should fix them in the future. image

    By the way, to support initrd for Linux, I tried to turn on the CONFIG_BLK_DEV_INITRD and CONFIG_BLOCK in tiny.config and use the config to compile Linux first. But it still can't work when only enable them. Some reports like Kernel panic - not syncing: No init found. Try passing init= option to kernel. still happen. So I turn to use the default config for x86 (by make x86_64_defconfig) in this patch.

    opened by RinHizakura 6
  • Handle serial input using timerfd mechanism

    Handle serial input using timerfd mechanism

    This PR is related to #4.

    The problem of serial implementation is: If no condition which should be handled happens, VM will always run inside the loop of KVM_RUN ioctl. To solve the issue, the previous solution of kvm-host is using another thread to handle serial input. On the other hand, another solution is using a timer to periodically return from KVM_RUN ioctl. The latter solution may not certainly be more efficient. For example, although no POSIX thread is needed for the latter solution, the timer interrupt may cause extra cost if we return from KVM_RUN ioctl without anything that needs to be handled.

    But if we only consider the simplicity, the latter solution seems to be indeed better. So we change the implementation for such reason now.

    opened by RinHizakura 5
  • Emulate the basic requiremnt of UART to boot Linux

    Emulate the basic requiremnt of UART to boot Linux

    This patch implements more emulation of the serial UART. Therefore, we can perform serial communications more completely, including receive information and interact with the command line for some BusyBox Unix utilities.

    There are some options for implementation which could be discussed according to your decision of the development of this project:

    • The implementation of UART now could be more complete or simpler. It depends on what we are going to do with the loading kernel image.
    • You mentioned the possibility to use coroutine instead of thread to implement UART. However, I'm not sure if it is worth for our current requirements:
      • If no condition (e.g. interrupted by I/O) which should be handled by our program happens, VM will always run inside the loop of KVM_RUN ioctl. If we want to yield the control back from KVM_RUN ioctl for the coroutine, we may need more mechanisms (e.g. timer?) to achieve this. So things would become harder.
      • The task of the created thread is very simple now. If there are no other tasks (e.g. other hardware emulation), I'm not sure of the necessity of the coroutine. Coupling with there are many ways to design for coroutine mechanism, I can't decide for the best implementation for this project.
    opened by RinHizakura 4
  • Implement the basis of virtio-blk

    Implement the basis of virtio-blk

    The support of the virtio-blk device enables Guest Linux to access the disk image in Host. It passes the test on ext4 file system.

    We also introduce virtio-pci and virtq which can be utilized by other virtio devices just like virtio-blk.

    opened by ray90514 3
  • Handle serial input without lock

    Handle serial input without lock

    This PR is going to solved #4, and some of the discussion and where this comes from can be found in #5.

    The problem of serial implementation is: If no specific condition which should be handled in userspace happens, VM will always run inside the loop of KVM_RUN ioctl in kernel. The user's keyboard inputs can't make it return from kernel directly.

    To solve the issue, the previous solution of kvm-host uses another worker thread to handle serial input itself, which will need an extra mutex because it will access the VM-related data. However, under the implementation, we can't manage the code flow of main thread and worker thread narrowly, since they'll schedule by our operating system. And we also need to carefully define the critical section for both the performance and correctness.

    Because of those reasons, this patch makes a reimplementation. Now, although we still need a thread for kvm-host, the worker thread doesn't access the VM-related data. Instead, it just "tells" the main thread that it needs to spend some time for the serial inputs first by signal. So we don't need to worry about data race under this design, which makes everything simple. And we can also improve the cooperative because now we can decide the code flow between serial input and KVM instead of partially depending on the operating system.

    opened by RinHizakura 2
  • Re-implement 8250 serial device

    Re-implement 8250 serial device

    tinybox is a neat tool for hosting KVM guests. Its 8250 serial implementation uses poll(2) along with kvm__irq_line for efficient handling. There is no POSIX thread needed. We might rework the existing 8250 serial in kvm-host.

    opened by jserv 2
  • Parse the the cmdline arguments more perfectly

    Parse the the cmdline arguments more perfectly

    I try to use getopt to build a standard mechanism to parse command-line options, so it would be more easily to add new option in the future. This patch also makes the initrd input to be optional, since it is not indispensable for kvm-host. README.md is also changed accordingly for the new command-line interface.

    The design of the command-line interface is just my favorite style, but I'm not sure if there's any insufficient. Please tell me if there's any bad implementation that should be revised.

    opened by RinHizakura 1
  • Implement UART device on the same abstraction of PCI

    Implement UART device on the same abstraction of PCI

    In #9 , we have an abstraction of bus device with read and write method now. Since we have PCI and UART device emulation now, and there could be more in the future. We should integrate them with the same abstractions.

    opened by RinHizakura 0
kvm based x86 partitioned hypervisor written in cpp

mumu is a hobby hypervisor-ish. mumu can be a good resource to learn virtualization, hypervisors and KVM right now. In the future, who knows, it may become a real hypervisor.

Musa Ünal 6 Oct 9, 2021
TinyVM is a small, fast, lightweight virtual machine written in pure ANSI C.

TinyVM is a virtual machine with the goal of having a small footprint. Low memory usage, a small amount of code, and a small binary. Building can be

Joseph Kogut 2.9k Jul 4, 2022
Web runtime for the uxn virtual machine.

webuxn A light-weight port of the uxn virtual machine to the web via WebAssembly. Demos life.rom darena.rom animation.rom musictracker.rom Bring Your

Bruno Garcia 54 May 21, 2022
A virtual machine hardware tool that gives you an escape option for when your VM locks you in (when it freezes, and also traps your mouse).

A virtual machine hardware tool that gives you an escape option for when your VM locks you in (when it freezes, and also traps your mouse). A secondary mouse that only activates once you press it.

Sean P. Myrick V19.1.7.2 1 Oct 25, 2021
A mini x86 hypervisor

MVisor: A mini x86 hypervisor Goal A minimal hypervisor based on KVM and x86 (replace QEMU) A limited number of emulated devices (support plugins in l

Xiaoxia 46 Apr 26, 2022
A C program to retrieve information about your Linux machine

Reporter A C program to retrieve information about your Linux machine How to Install Open the terminal and type following commands apt update apt inst

Sc1r3Cr0w 5 Jun 14, 2022
A virtual processor with a unique instruction set written in C++

Processor-Project A virtual processor with an instruction set similar to ARM made in C++. How it works This virtual processor allows the user to write

null 20 May 27, 2022
Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices

ptitSeb 1.2k Jul 5, 2022
A kernel designed to run one and only one application in a virtualized environment

A kernel designed to run one and only one application in a virtualized environment

NanoVMs 1.8k Jun 28, 2022
A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux.

wiser A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux. Following project is under-development expect unfinished co

flouthoc 245 Jun 24, 2022
Leo Hypervisor. Type 1 hypervisor on Raspberry Pi 4 machine.

Leo Hypervisor Leo. Type 1 hypervisor on Raspberry Pi 4 machine. Set Up This setup was tested on Debian Install Required Dependencies and Toolchain su

Mushahid Hussain 9 Apr 16, 2022
kvm based x86 partitioned hypervisor written in cpp

mumu is a hobby hypervisor-ish. mumu can be a good resource to learn virtualization, hypervisors and KVM right now. In the future, who knows, it may become a real hypervisor.

Musa Ünal 6 Oct 9, 2021
A modern dynamically typed programming language that gets compiled to bytecode and is run in a virtual machine called SVM (Strawbry Virtual Machine).

Strawbry A bytecode programming language. Here is what I want Strawbry to look like: var a = 1 var b = 2 var c = a + b print(c) func sqrt(x) { re

PlebusSupremus1234 6 Jan 5, 2022
Professor Terence Parr has taught us how to create a virtual machine Now it is time to pwn virtual machine

My First real world CTF Simple Virtual Machine Challenge description Professor Terence Parr has taught us how to create a virtual machine Now it is ti

null 1 Feb 17, 2022
PET: Optimizing Tensor Programs with Partially Equivalent Transformations and Automated Corrections

PET: Optimizing Tensor Programs with Partially Equivalent Transformations and Automated Corrections PET is the first DNN framework that optimizes tens

PACMAN Group, Tsinghua University 69 Jun 26, 2022
Gunyah is a Type-1 hypervisor designed for strong security, performance and modularity.

Gunyah is a Type-1 hypervisor, meaning that it is independent of any high-level OS kernel, and runs in a higher CPU privilege level. It does not depend on any lower-privileged OS kernel/code for its core functionality. This increases its security and can support a much smaller trusted computing base than a Type-2 hypervisor.

Qualcomm Innovation Center 65 Jun 27, 2022
type 2 hypervisor written in c++

Hypervisor : RU Краткое описание. Hypervisor - это гипервизор второго типа, который виртуализирует уже запущенную систему. Для запуска данного гиперви

null 7 Jun 10, 2022
Dohd is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP)

dohd Dohd (pron. doh-dee) is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP). Fe

Dyne.org 14 Jun 26, 2022
FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts.

FFF is a decentralized blockchain based on IPFS/RIPPLE, which integrates lua virtual machine-based smart contracts. It is also a software platform designed to help coordinate voluntary free market operations amongst a set of social actors.

gen2600 5 May 31, 2022
A virtual network Differential GNSS server-client project using Precise Point Positioning (PPP). Global coverage. Without physical base station construction needed. An open-source virtual base station approach.

Virtual-Network-DGNSS-Project This project is the software implementation for a publicly available, open-source, client/server VN-DGNSS implementation

null 10 May 20, 2022
Kernel with ARM/KVM for SM-A600G (Samsung Galaxy A6) with Exynos7870 SoC

Kernel source for SM-A600G (Samsung Galaxy A6 with exynos7870) with KVM support. Warning: Super long text ahead, be careful not to mess up your brain

@raspiduino 3 Jun 27, 2022
A Linux Host-based Intrusion Detection System based on eBPF.

eHIDS 介绍 eBPF内核技术实现的HIDS demo. 功能实现: TCP网络数据捕获 UDP网络数据捕获 uprobe方式的DNS信息捕获 进程数据捕获 uprobe方式实现JAVA的RASP命令执行场景事件捕获 eBPF的go框架实现,针对kprobe\uprobe挂载方式,多类型even

CFC4N 236 Jul 1, 2022
Monitor based on perf_event: split-lock, irq-off, profile, task-state, watchdog, kmemleak, kvm-exit, mpdelay

基于perf的监控框架 基于libperf和libtraceevent库实现简单的监控框架,提供比perf更灵活的特性。 数据不落盘。 数据过滤,基于tracepoint的过滤机制,减少数据量。 数据实时处理并输出。不需要存盘后再处理。 基于perf_event_open系统调用。 虽然比perf更

null 8 Jun 24, 2022
Encrypted shellcode injector with basic virtual machine evasion using C++

C++ PE Injector Overview Fully undetectable shellcode injector written in C++ with customizable XOR payload encryption/decryption and basic antivirus

Kampourakis Emmanouil 5 Apr 5, 2022
Hardware-accelerated DNN model inference ROS2 packages using NVIDIA Triton/TensorRT for both Jetson and x86_64 with CUDA-capable GPU.

Isaac ROS DNN Inference Overview This repository provides two NVIDIA GPU-accelerated ROS2 nodes that perform deep learning inference using custom mode

NVIDIA Isaac ROS 36 Jun 20, 2022
General purpose power controller, capable of driving soldering irons using different voltages and probe types.

All-purpose Power Micro Controller This general purpose power micro controller features: Wheatstone Bridge front-end New Texas Instruments INA823 inst

Tomasz Jastrzębski 26 Jun 27, 2022
Brutally effective DNS amplification ddos attack tool. Can cripple a target machine from a single host. Use with extreme caution.

Brutally effective DNS amplification ddos attack tool. Can cripple a target machine from a single host. Use with extreme caution.

thescientist 13 Jun 27, 2022
A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

Mark Hofmeister 2 Mar 9, 2022