[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 13/20] create-diff-object: Strip all undefined entires of known size

On 8/21/19 9:20 AM, Pawel Wieczorkiewicz wrote:
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

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.

The livepatch_strip_undefined_elements() is a superset of the
kpatch_regenerate_special_section() in both scope (covers all RELA
sections instead of just special sections) and granularity (checks
all entries instead of whole groups) modulo the entries validity
Unifying the functions results in a complicated code, which is hard
to reason about. Thus, the kpatch_regenerate_special_section() is
kept separate with its own predicate for special sections only, and
livepatch_strip_undefined_elements() follows for all sections with
the undefined symbol detecting predicate.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
Reviewed-by: Martin Pohlack <mpohlack@xxxxxxxxx>
Reviewed-by: Bjoern Doebel <doebel@xxxxxxxxx>
Reviewed-by: Norbert Manthey <nmanthey@xxxxxxxxx>
Reviewed-by: Andra-Irina Paraschiv <andraprs@xxxxxxxxxx>

Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.