How to Monkey-Patch the Linux Kernel
https://blog.cloudflare.com/how-to-monkey-patch-the-linux-kernel/ [blog.cloudflare.com]
2017-10-29 16:21
That was mostly fine, until recently, when my machine, unannounced, updated to Wayland.
It wold be nice if that didn’t happen, but given that it does...
SystemTap’s command-line tool, stap, compiles your script into a Linux kernel module and loads it. The module, on load, will find the function you want to probe and will overwrite it with a jump to your probing code. The probe code does what you specify, then jumps back to the original function body to continue as usual.