livepatch/core: Allow implementation without ftrace
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8MGE6 CVE: NA -------------------------------- Currently livepatch implementation is based on ftrace, and coming patches will introduce a new solution without ftrace which will use config CONFIG_LIVEPATCH_WO_FTRACE. Implements livepatch without ftrace by direct jump, we directly modify the first few instructions(usually one, but four for long jumps under ARM64) of the old function as jump instructions by stop_machine, so it will jump to the first address of the new function when livepatch enable KERNEL/MODULE call/bl A---------------old_A------------ | jump new_A----+--------| | | | | | | ----------------- | | | | livepatch_module------------- | | | | |new_A <--------------------+--------------------| | | | | |---------------------------| | .plt | | ......PLTS for livepatch | ----------------------------- Something we need to consider under different architectures: 1. jump instruction 2. partial relocation in new function requires for livepatch. 3. long jumps may be required if the jump address exceeds the offset. both for livepatch relocation and livepatch enable. So isolate ftrace based codes with config CONFIG_LIVEPATCH_FTRACE, then make livepatch solutions optional so that users can select between solutions later. Note that, in this patch, the new solution that without ftrace isn't implemented, but just enable its config CONFIG_LIVEPATCH_WO_FTRACE on x86_64 to ensure that there is no compile problems. Signed-off-by:Cheng Jian <cj.chengjian@huawei.com> Signed-off-by:
Wang ShaoBo <bobo.shaobowang@huawei.com> Signed-off-by:
Dong Kai <dongkai11@huawei.com> Signed-off-by:
Ye Weihua <yeweihua4@huawei.com> Signed-off-by:
Zheng Yejian <zhengyejian1@huawei.com>
Loading
Please sign in to comment