Skip to content

Instantly share code, notes, and snippets.

@mcastelino
mcastelino / debugging-cc-agent.md
Created April 23, 2018 23:16 — forked from devimc/debugging-kata-agent.md
Debugging cc-agent

Create a functional Clear Container image using osbuilder

sudo -E IMG_SIZE=520M EXTRA_PKGS="dbus-bin dbus-autostart util-linux-bin p11-kit-bin bash shadow ca-certs dist-pam-configs xz-bin tar-bin grep-bin sed-bin pigz-bin iproute2-bin procps-ng-bin psstop-bin htop-bin curl nano make-bin" make rootfs
sudo -E IMG_SIZE=520M make image

Start a new VM

@mcastelino
mcastelino / modern_qemu.md
Created April 23, 2018 22:00
Modern QEMU Configuration
../configure \
 --disable-bluez \
 --disable-brlapi \
 --disable-curl \
 --disable-curses \
 --disable-fdt \
 --disable-netmap \
 --disable-sdl \
 --disable-virtfs \
@mcastelino
mcastelino / kvmtool_slirp_user_mode_network.md
Last active April 6, 2018 17:06
kvmtool user mode networking implementation

invocation

./lkvm run --kernel bzImage --disk rootfs.ext4 --debug --network mode=user

Inside the VM

@mcastelino
mcastelino / rawsocket.md
Created April 5, 2018 19:04
Raw Sockets debugging

How to track raw sockets

Example program

Say a program has opened a raw socket. How do you know it has it open

+       int sock_r;
+       struct ifreq ifrr;
+ size_t if_name_len=strlen("dummy0");
@mcastelino
mcastelino / kvm-qemu-signals.md
Created March 30, 2018 16:56
KVM - How does the VM return control back to the controlling VMM process on signals

How to setup the controlling process to handle signals

  1. Setup a signal handler for the vcpu thread for that signal. It does not have to do anything
  2. When a signal is sent to the thread hosting the VM it will result in EINTR (not a reported kvm exit reason)
                signal(SIGUSR1,sig_func); // Register signal handler inside thread, the function is empty
                ret = ioctl(kvm->vcpus->vcpu_fd, KVM_RUN, 0);

                if (ret < 0) {
@mcastelino
mcastelino / qemu_migrate.md
Last active March 21, 2024 21:06
Using Local Virtual Machine Migration to perform fast VM launch using QEMU

Overview

QEMU supports migration of a virtual machine across machine over the network. It also has the capability to save the state of a virtual machine and resume from that state.

It is described in detail in https://www.linux-kvm.org/page/Migration

This capability can be leveraged to create an instant resume virtual machine image if the virtual machine is crafted with care.

Creating a Virtual Machine that can be fast resumed

@mcastelino
mcastelino / Rust.md
Last active March 27, 2018 00:09
Rust - My notes

Useful vim setup

Plugins

git clone --depth=1 https://github.com/rust-lang/rust.vim.git ~/.vim/bundle/rust.vim
git clone --depth=1 https://github.com/ConradIrwin/vim-bracketed-paste ~/.vim/bundle/vim-bracketed-paste

Tools

@mcastelino
mcastelino / qemu_console_forward.md
Last active February 16, 2023 23:50
QEMU Console forwarding
@mcastelino
mcastelino / kata-docker-dns.md
Created March 20, 2018 17:34
Supporting docker DNS resolution in Kata Containers