livepatch/ppc64: Implement per func_node livepatch trampoline
hulk inclusion
category: feature
bugzilla: 51924
CVE: NA
---------------------------
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>
Reviewed-By:
Xie XiuQi <xiexiuqi@huawei.com>
Signed-off-by:
yangerkun <yangerkun@huawei.com>
Signed-off-by:
Dong Kai <dongkai11@huawei.com>
Signed-off-by:
Ye Weihua <yeweihua4@huawei.com>
Reviewed-by:
Kuohai Xu <xukuohai@huawei.com>
Reviewed-by:
Yang Jihong <yangjihong1@huawei.com>
Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>
Loading
Please sign in to comment