Skip to content

Latest commit

 

History

History
161 lines (105 loc) · 3.43 KB

File metadata and controls

161 lines (105 loc) · 3.43 KB
title Tracing the syscall of the wild

Tracing the syscall of the wild


Compile me with pandoc --standalone --to=revealjs --output=README.html README.md

Env for demos can be prepared by nix develop or nix develop --command $SHELL


Miscellany

  • Meeting time conflicts with ACM x WCS
  • GLUG/ACM cloud??

Debugging with strace

  • Create new process (strace $cmd) or attach to existing one (strace -p $pid)

  • Filter by syscall (--trace=openat) or group of syscalls (--trace=%file)


$ strace --follow-forks --trace=%file --output=log ls
...

$ cat log
...
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3

$ strace --follow-forks --trace=%file --output=log ls -l
...

$ cat log
...
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
statx(AT_FDCWD, "spack.yaml", ...) = 0
many times

$ strace --follow-forks --trace=openat --output=log zsh -c 'echo hi'
hi

$ cat log
...
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 11
openat(AT_FDCWD, "/etc/zshenv", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/sam/.zshenv", O_RDONLY|O_NOCTTY) = 3
openat(AT_FDCWD, "/home/sam/.config/zsh/.zshenv", O_RDONLY|O_NOCTTY) = 3
openat(AT_FDCWD, "/home/sam/.nix-profile/etc/profile.d/hm-session-vars.sh", O_RDONLY|O_NOCTTY) = 3
openat(AT_FDCWD, "/dev/null", O_RDONLY|O_NOCTTY) = 3

rr debugger


$ python -c "import random; print(random.choice(range(100)))"
39

$ rr record python -c "import random; print(random.choice(range(100)))"
rr: Saving execution to trace directory `/home/sam/.local/share/rr/python-5'.
59

$ rr replay --autopilot /home/sam/.local/share/rr/python-5
59

$ rr dump /home/sam/.local/share/rr/python-5 > log

$ less log


CDE


VM


Hybrid Runtime


Hybrid Runtime

  • Turn off interrupts
  • Use hugepages
  • No scheduler
  • Let Linux handle FS

Nautilus (hybrid runtime)

$ make menuconfig
# exit, saving config

$ make isoimage

Performance engineering

  • Strace has wicked overhead because switch processes every traced syscall.
  • How to avoid? => Write filtering logic in kernel??
  • eBPF := a restricted language, safe to execute within kernel!
  • Implement filtering logic in eBPF


Future topics