Patching kernel functions in memory on a live machine. Taken from samples/livepatch.
This livepatch kernel module creates a replacement for cmdline_proc_show()
from fs/proc/cmdline.c
to simply print a message out instead of the usual cmdline.
To use:
cat /proc/cmdline
make
, and load into the kernel with insmod livepatch-sample.ko
cat /proc/cmdline
echo 0 | sudo tee /sys/kernel/livepatch/livepatch-sample/enabled
rmmod livepatch-sample.ko
Tested on Ubuntu 20.04 running under Vagrant.