原理
Theroy¶
This page only introduce theroy of ULPatch, but not the implementation details.
All programs are single-threaded models, so you will not see synchronization locks in the code. Of course, we need to consider the multi-threaded situation of the target process.
ULPatch¶
Patch¶
The following figure shows the livepatch loading procedures.
The detailed steps are as follows:
- Compile source code into a relocatable ELF file, it's livepatch file;
- Load the relocatable ELF file into the target process address space;
- Relocate the symbols in the patch according to the target process address symbol table;
- Modify the patch function entry to jump to the patch function;
Unpatch¶
The following figure shows the uninstall procedures of the livepatch.
The unpatch
operation is the reverse operation of patch
, but without the relocate process.
ULTask¶
It's an useful tool to modify target process, I call it Program Modifier. CONFIG_BUILD_ULTASK
decides whether to compile ultask
. Check manual ultask(8)
to see more.
TODO
ULFtrace¶
Same as linux ftrace, need gcc -pg
compile option. CONFIG_BUILD_ULFTRACE
decides whether to compile ulftrace
. Check manual ulftrace(8)
to see more.
TODO