Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kpatch-build: strengthen conditions for changed sections
If two sections want to be the same, they need to satisfy two conditions: 1) the result of memcmp is zero, which means they the have same content. 2) they have the same relocation entries. In one specific situation, two sections have the same content. But one section has relocation entries while the other one has no relocation entries. For example, in X86, consider the following code: original code ``` __noreturn noinline int kpatch_func(void) { while(1) {}; } ``` patched code ``` __noreturn notrace noinline int kpatch_func(void) { asm(".byte 0xe8, 0x00, 0x00, 0x00, 0x00"); while(1){}; } ``` Since the original code has a fentry call, these two functions have the same compile result. But obviously, they are different functions. Currently, kpatch would not find their differences since the patched code has no relocation entries. For the situation that one section has relocation entries while the other one doesn't have, it should be set to be changed directly. Cooperated-by: Zongwu Li <lizongwu@huawei.com> Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
- Loading branch information