mirror of https://github.com/dynup/kpatch
ef0ce9715a
Building data-read-mostly.patch on rhel-9.0-beta for ppc64le leads to a segmentation fault: Program received signal SIGSEGV, Segmentation fault. kpatch_check_relocations (kelf=0x10040490) at create-diff-object.c:2571 2571 sdata = rela->sym->sec->data; (gdb) bt (gdb) p rela->sym->sec->data Cannot access memory at address 0x160000007e Valgrind narrows the problem down to invalid reads through rela->sym in kpatch-check-relocations(). The culprits are kpatch_create_intermediate_sections(), which marks symbols referenced by rela sections that are now dynrelas to be stripped, and kpatch_strip_unneeded_syms(), which removes and frees them. The problem with the symbol stripping is that multiple relas may reference the same ELF symbol. If any remaining relocation references a shared symbol, we must keep it. Replace the symbol->strip boolean with an enumeration: SYMBOL_DEFAULT - initial value, symbol usage unknown SYMBOL_USED - symbol is definitely used by a rela SYMBOL_STRIP - symbol was only referenced by dynrela(s) Allow transitions from SYMBOL_DEFAULT to SYMBOL_* and SYMBOL_STRIP to SYMBOL_USED, but _not_ SYMBOL_USED to SYMBOL_*. Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> |
||
---|---|---|
.. | ||
objs@365ce3af2b | ||
Makefile | ||
Makefile.include |