On 8/8/19 1:48 PM, Pawel Wieczorkiewicz wrote:
During verification check if all sections do not contain any entries
with undefined symbols (STN_UNDEF). This situation can happen when a
section is copied over from its original object to a patched object,
but various symbols related to the section are not copied along.
This scenario happens typically during stacked hotpatches creation
(between 2 different hotpatch modules).
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Reviewed-by: Martin Pohlack <[email protected]>
Reviewed-by: Bjoern Doebel <[email protected]>
Reviewed-by: Norbert Manthey <[email protected]>
Reviewed-by: Andra-Irina Paraschiv <[email protected]>
... snip
+static int kpatch_section_has_undef_symbols(struct kpatch_elf *kelf,
+ const struct section *sec)
+{
+ int offset, entry_size;
+ struct rela *rela;
+ size_t d_size;
+
+ entry_size = get_section_entry_size(sec, kelf);
+ if (entry_size == 0)
+ return false;
+
+ d_size = sec->base->data->d_size;
+ for ( offset = 0; offset < d_size; offset += entry_size ) {
The coding style doesn't use spaces inside the for loop parentheses.
+ list_for_each_entry(rela, &sec->relas, list) {
+ if (rela->offset < offset ||
+ rela->offset >= offset + entry_size) {
+ continue;
+ }
+
+ if ((GELF_R_SYM(rela->rela.r_info) == STN_UNDEF) ||
+ (!rela->sym->include && rela->sym->status == SAME))
{
+ log_normal("section %s has an entry with a STN_UNDEF
symbol: %s\n",
+ sec->name, rela->sym->name ?:
"none");
Perhaps this log message is a bit misleading if only the second
condition is true? Maybe something slightly more general like "has an
entry with an undefined symbol".
Otherwise looks OK to me.
Thanks,
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel