livepatch/ppc64: Implement livepatch without ftrace for ppc64be
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8MGE6 --------------------------- Initially completed the livepatch for ppc64be, the call from the old function to the new function using stub space. We call from old func to new func, when return form new func, we need to restore R2. The previous module relocation was by adding an extra nop space after the call (bxxx) instruction to restore R2, but it is impossible to use extra space here, because we will not return after calling new func, so we need to use a trampoline space. We will call new func in trampoline and then restore R2 when we return. Please note that we can also use old func as trampoline as a solution, but we are afraid that old func often does not have that much space to store trampoline instruction fragments. The trampoline can be implemented as global. However we need to implement a trampoline for each function and improve its stack check. Our call chain to the new function looks like this: CALLER old_func | old_func | -=> trampoline | -=> new_func So we can't simply check that new_func, old_func and trampoline are both possible on the stack. Signed-off-by:Cheng Jian <cj.chengjian@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