MCPcopy Index your code
hub / github.com/asamy/ksm

github.com/asamy/ksm @v1.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5 ↗ · + Follow
554 symbols 1,782 edges 32 files 55 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ksm v1.5 BountySource Build Status Build Status

A really simple and lightweight x64 hypervisor written in C for Intel processors.
KSM has a self-contained physical memory introspection engine and userspace physical memory virtualization which can be enabled at compiletime.

Currently, KSM runs on Windows and Linux kernels natively, and aims to support macOS by 2017, if you want to port KSM see Documentation/SPEC.md for more information.

Unlike other hypervisors (e.g. KVM, XEN, etc.), KSM's purpose is not to run other Operating Systems, instead, KSM can be used as an extra layer of protection to the existing running OS. This type of virtualization is usually seen in Anti-viruses, or sandboxers or even Viruses. KSM also supports nesting, that means it can emulate other hardware-assisted virtualization tools (VT-x) such as KVM or itself, it's however an experimental feature and is not recommended.

Usage under Linux (+sandbox)

asciicast

Features

  • IDT Shadowing
  • EPT violation #VE (enabled only when support is present)
  • EPTP switching VMFUNC (if not available natively, it will be emulated using a VMCALL)
  • Builtin Userspace physical memory sandboxer (Optional)
  • Builtin Introspection engine (Optional)
  • APIC virtualization (Experimental, do not use)
  • VMX Nesting (Experimental, do not use)

Requirements

  • An Intel processor (with VT-x and EPT support)
  • A working C compiler (GCC or Microsoft compiler aka CL are supported)

Supported Kernels

  • All x64 NT kernels starting from the Windows 7 NT kernel. It was mostly tested under Windows 7/8/8.1/10.
  • Linux kernel (tested under 3.16, 4.8.13 and mainline)

If you have tested it under another kernel version, please create an issue so it can be added here.

Technical Documentation

See Documentation/SPEC.md

Contributions

See Documentation/CONTRIBUTIONS.md

Building / Usage

See Documentation/BUILDING.md

Reporting bugs (or similar)

You can report bugs using Github issues, there is an Issue Template to help you fill things as needed.

References

  • Linux kernel (KVM)
  • HyperPlatform
  • XEN

License

GPL v2 firm, see LICENSE file. Note that some code is thirdparty, respective licenses and/or copyright should be there, if you think it's not, please let me know. Most of the code is GPL'd, though...

Core symbols most depended-on inside this repo

vmcs_write
called by 85
vmx.h
vmcs_read
called by 66
vmx.h
vmcs_write32
called by 65
vmx.h
vmcs_write16
called by 39
vmx.h
vmcs_read32
called by 32
vmx.h
vmcs_write64
called by 30
vmx.h
vcpu_advance_rip
called by 30
exit.c
nested_has_primary
called by 26
exit.c

Shape

Function 434
Class 117
Enum 3

Languages

C59%
C++41%

Modules by API surface

exit.c114 symbols
ksm.h78 symbols
vmx.h39 symbols
x86.h37 symbols
vcpu.c30 symbols
mm.h30 symbols
sandbox.c27 symbols
list.h26 symbols
htable.c26 symbols
epage.c23 symbols
introspect.c21 symbols
ksm.c15 symbols

For agents

$ claude mcp add ksm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact