Skip to content

Instantly share code, notes, and snippets.

View shpark's full-sized avatar

Seonghyun Park shpark

View GitHub Profile
/usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu EPYC -machine q35 -smp 4,maxcpus=64 -m 4096M,slots=5,maxmem=30G -no-reboot -drive if=pflash,format=raw,unit=0,file=/usr/local/share/qemu/OVMF_CODE.fd,readonly -drive if=pflash,format=raw,unit=1,file=/home/sev-host/amdsev/focal.fd -netdev user,id=vmnic -device e1000,netdev=vmnic,romfile= -drive file=/home/sev-host/amdsev/focal.qcow2,if=none,id=disk0,format=qcow2 -device virtio-scsi-pci,id=scsi0,disable-legacy=on,iommu_platform=true -device scsi-hd,drive=disk0 -object sev-guest,id=sev0,policy=0x5,cbitpos=47,reduced-phys-bits=1 -machine memory-encryption=sev0,vmport=off -nographic -vnc :0 -monitor pty -monitor unix:monitor,server,nowait

Notes

  • <image_name>.fd (e.g., focal.fd) is automatically generated. It is copied from OVMF_VARS.fd.
  • -object sev-guest,id=sev0,policy=0x5,cbitpos=47,reduced-phys-bits=1 -machine memory-encryption=sev0,vmport=off enables sev-es.
  • -device virtio-scsi-pci,id=scsi0,disable-legacy=on,iommu_platform=true virtio-sc
@shpark
shpark / gpg-trouble-shooting.md
Last active April 9, 2021 08:31
GPG troubleshooting

SO link.

  1. Add export GPG_TTY=$(tty) to .bashrc.
  2. git config --global user.signingkey <key id>; <key id> can be found in the output of gpg --list-keys (public key?).
  3. Example ~/.gnupg/gpg-agent.conf:
pinentry-program /usr/bin/pinentry-curses
allow-loopback-pinentry
  1. Reload gpg-agent: gpg-connect-agent reloadagent /bye.

Look at the following x86 assembly code (from lua repository).

static inline void coco_switch(coco_ctx from, coco_ctx to)
{
  __asm__ __volatile__ (
    "call 1f\n" "1:\tpopl %%eax\n\t" "addl $(2f-1b),%%eax\n\t"
    "movl %%eax, (%0)\n\t" "movl %%esp, 4(%0)\n\t"
    "movl %%ebp, 8(%0)\n\t" "movl %%ebx, 12(%0)\n\t"
 "movl 12(%1), %%ebx\n\t" "movl 8(%1), %%ebp\n\t"
  • Create root file system image
cd $IMAGE/
wget https://raw.githubusercontent.com/google/syzkaller/master/tools/create-image.sh -O create-image.sh
chmod +x create-image.sh
./create-image.sh

-d buster for Debian 10, and -s 16384 for larger disk size.

Keybase proof

I hereby claim:

  • I am shpark on github.
  • I am shpark1 (https://keybase.io/shpark1) on keybase.
  • I have a public key whose fingerprint is 6A32 BB2B 46E3 0437 44DE 705A 358D F6DB 75F4 67E2

To claim this, I am signing this object:

@shpark
shpark / README.md
Last active March 29, 2021 04:22
Arch Linux installation and setup trouble shootings

Arch Linux installation and setup trouble shootings

Network Configuartion

Here are the summary of how to connect to the network (wireless/ethernet) during the installation.

Wireless

This link provides good explanation on how to connect to a WPA/WPA2 Wi-Fi network.