Watch Can strace make you fail? strace syscall fault injection by Dmitry Levin who is its current maintainer.


I find myself needing to use strace(1) to debug stuffs a lot but recently, I found myself re-visiting it. Enter syscall tampering / fault injection - Youtube talk by Dmitry Levin Fault Injection in strace.

The reason fault injection becomes a useful tool to have in the arsenal is because you may need to dynamically inject error path into codes developed using Go / Rust / C (amongst the modern language ecosystem). With strace(1), from the application’s point of view, it is all as if Linux kernel handled the system call as per your application’s need; where in-fact strace(1) dynamically instrumented the target syscall and injected the fault for your application.

The alternative to strace(1) is a little costly - bcc/ebpf that need to be instrumented at compile-time (but bcc/ebpf is extremely powerful!) or perf (extremely heavyweight).

Until next Interesting links, keep testing injecting those faults in your code! :-)