livepatch/arm: Add support for livepatch plt
euler inclusion category: feature bugzilla: 51923 CVE: N/A ---------------------------------------- The offset of the direct jump under ARM is 32M. Longer jumps are required to exceed this range. First-- long jump for relocations If the jump address exceeds the range in these relocation, it needs to be implemented with a long jump. but there is no function for us to modify its first LJMP_INSN_SIZE instructions like enable livepatch do, we should use module plts to store the information. so we need enough PLTS to store the symbol. The .klp.rela.objname.secname section store all symbols that required relocate by livepatch. For commit 425595a7 ("livepatch: reuse module loader code to write relocations") merged, load_module can create enough plt entries for livepatch by module_frob_arch_sections. However, the module loader only use rel section, this is will be fixed in the next commits and need adapter kpatch-build front-tools. Second-- long jump for call new function We modify several instructions from the beginning of the function to jump instructions, thus completing the jump from the old function to the new function. Unlike the relocation information, there is no plt sections to use here, so use the LDT instruction to complete the long jump using the LDT instruction. [PC+0]: ldr PC [PC+8] [PC+4]: nop [PC+8]: new_addr_to_jump Signed-off-by:Cheng Jian <cj.chengjian@huawei.com> Reviewed-by:
Bin Li <huawei.libin@huawei.com> Signed-off-by:
zhangyi (F) <yi.zhang@huawei.com> Signed-off-by:
Dong Kai <dongkai11@huawei.com> Signed-off-by:
Ye Weihua <yeweihua4@huawei.com> Reviewed-by:
Yang Jihong <yangjihong1@huawei.com> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>
Loading
Please sign in to comment