Skip to content

fabiomurer/syskvm

Repository files navigation

SYSKVM

SYStem call Kvm Virtual Machine, run user-mode program in a KVM virtual machine.

Demo

$ cat /etc/shadow
cat: /etc/shadow: Permission denied
$
$ ./syskvm -f -- cat /etc/shadow
root:$6$abcdefgh$1234567890abcdefghijklmnopqrstuvwx:19000:0:99999:7:::
daemon:*:19000:0:99999:7:::
bin:*:19000:0:99999:7:::
sys:*:19000:0:99999:7:::
sync:*:19000:0:99999:7:::
games:*:19000:0:99999:7:::
man:*:19000:0:99999:7:::
lp:*:19000:0:99999:7:::
mail:*:19000:0:99999:7:::
news:*:19000:0:99999:7:::
syskvm:$6$ijklmnop$0987654321ponmlkjihgfedcbazyxwvutsr:19000:0:99999:7:::

How it works

syskvm diagram

In my thesis you can find all the deltails.

Usage

$ ./syskvm --help
Usage: syskvm [OPTION...] [ARGS...]
Run user-mode code in a kvm vm

  -d, --debug=HOST:PORT      Enable debug mode with specified server
  -f, --vfiles               Enable virtual files
  -p, --pin=CORE             Pin to specified CPU core
  -t, --trace                Enable trace mode
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to https://github.com/fabiomurer/syskvm.

Runnin tests

compile test:

# in syskvm/tests
$ make

# run it
$ ./syskvm -t -- [test_name] # for ex. ./hello

Debugging virtualized program with gdb

GDB support is only partial (some commands are not yet supported)

For example debug the test hello

in one terminal start syskvm with debug option

# in debug/
$ ./syskvm --debug="127.0.0.1:1234" -t -- ../syskvm/tests/hello

in one terminal run gdb in remote mode

# in syskvm/tests/
gdb
(gdb) file hello
Reading symbols from hello...
(gdb) target remote 127.0.0.1:1234
Remote debugging using 127.0.0.1:1234
_start () at hello.c:21
21	void __attribute__((noreturn)) __attribute__((section(".start"))) _start(void) {
...

Benchmarking

For benchmarking this implementation a script is provided.

Dependencies

first build syskvm in release mode

# in syskvm/tests
$ bash benchmark.bash [test-name] # es ./hello

Build

preparation

$ mkdir syskvm_
$ cd syskvm_
$ mkdir debug
$ mkdir release
$ git clone https://github.com/fabiomurer/syskvm.git
$ cd syskvm
$ git submodule init
$ git submodule update

directory tree should look like this:

.
└── syskvm_
    ├── debug
    ├── release
    └── syskvm

build

release

in release/ folder

$ cmake ../syskvm/ -DCMAKE_BUILD_TYPE=Release
$ make

debug

in debug/ folder

$ cmake ../syskvm/
$ make

formatting and linting

in debug/ or release/ folder

$ make format
$ make lint

About

SYStem call Kvm Virtual Machine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages