]> xenbits.xensource.com Git - people/wipawel/livepatch-build-tools/commit
create-diff-object: Strip all undefined entires of known size
authorPawel Wieczorkiewicz <wipawel@amazon.de>
Tue, 2 Oct 2018 15:06:59 +0000 (15:06 +0000)
committerPawel Wieczorkiewicz <wipawel@amazon.de>
Thu, 8 Aug 2019 09:53:13 +0000 (09:53 +0000)
commitd645f3748b2c57195c971fe8b139271b7996c319
treeaade6fc6086085cec0c9a5ecc998c816781f21ac
parentc553cc0b39a200666ee619abbbc377e3ed5a8432
create-diff-object: Strip all undefined entires of known size

The patched ELF object file contains all sections and symbols as
resulted from the compilation. However, certain symbols may not be
copied over to the resulting object file, due to being unchanged or
not included for other reasons.
In such situation the resulting object file has the entire sections
copied along (with all their entries unchanged), while some of the
corresponding symbols are not copied along at all.
This leads to having incorrect undefined (STN_UNDEF) entries in the
final hotpatch ELF file.

The newly added function livepatch_strip_undefined_elements() detects
and removes all undefined RELA entries as well as their corresponding
PROGBITS section entries.
Since the sections may contain elements of unknown size (sh.sh_entsize
== 0), perform the strip only on sections with well defined entry
sizes.

After replacing the stripped rela list, it is assumed that the next
invocation of the kpatch_rebuild_rela_section_data() will adjust all
section header parameters according to the current state.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Martin Pohlack <mpohlack@amazon.de>
Reviewed-by: Bjoern Doebel <doebel@amazon.de>
Reviewed-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Andra-Irina Paraschiv <andraprs@amazon.com>
create-diff-object.c